def add_image_args(parser):
    """Add arguments for specifying output image filenames and dimensions."""
    image_group = parser.add_argument_group('image file parameters')
    image_group.add_argument('filename', type=str, help=
        'filename to write the output to (.pdf or .png)')
    image_group.add_argument('width', type=float, nargs='?', help=
        'width of the image in mm for PDF and pixels for PNG (defaults to 280 mm if PDF and 1000 px for PNG)'
        )
    image_group.add_argument('height', type=float, nargs='?', help=
        'height of the image in mm for PDF and pixels for PNG (if only width is given, output will be at most width wide and width tall)'
        )
