Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEBP exif data #98

Open
Hesarn opened this issue Jan 12, 2020 · 0 comments
Open

WEBP exif data #98

Hesarn opened this issue Jan 12, 2020 · 0 comments

Comments

@Hesarn
Copy link

Hesarn commented Jan 12, 2020

Hi

it's not clear for me why should an exception should be raised if exif data is not present, it can be initialized like jpeg loader or at least a dedicated exception can be raised instead. The current behavior is making it hard to handle if there is no exif.

def get_exif(data):
    if data[0:4] != b"RIFF" or data[8:12] != b"WEBP":
        raise ValueError("Not WebP")

    if data[12:16] != b"VP8X":
        raise ValueError("doesnot have exif")

i think this behavior in jpeg loader, is more natural:

def load(input_data, key_is_name=False):
    """
    py:function:: piexif.load(filename)

    Return exif data as dict. Keys(IFD name), be contained, are "0th", "Exif", "GPS", "Interop", "1st", and "thumbnail". Without "thumbnail", the value is dict(tag name/tag value). "thumbnail" value is JPEG as bytes.

    :param str filename: JPEG or TIFF
    :return: Exif data({"0th":dict, "Exif":dict, "GPS":dict, "Interop":dict, "1st":dict, "thumbnail":bytes})
    :rtype: dict
    """
    exif_dict = {"0th":{},
                 "Exif":{},
                 "GPS":{},
                 "Interop":{},
                 "1st":{},
                 "thumbnail":None}
    exifReader = _ExifReader(input_data)
    if exifReader.tiftag is None:
        return exif_dict
@Hesarn Hesarn closed this as completed Jan 12, 2020
@Hesarn Hesarn reopened this Jan 12, 2020
@Hesarn Hesarn changed the title WEBP support problem WEBP exif data Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant