def derive_output_format(format, original_format):
    """returns uppercase"""
    format = format.upper()
    if format in ('AUTO', 'ORIGINAL'):
        _og_format = original_format.upper()
        if _og_format in ('PNG', 'GIF'):
            format = 'PNG'
        else:
            format = 'JPEG'
    return format
