You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into a problem when trying to use it with images that had no EXIF thumbnail—instead of lib.Exif(self.data).thumbnail being set to None, it's a zero-length byte array. So when the exif_thumbnail() function runs, it errors out because constructing JPEGImage(blob=None) is gonna throw an error.
A workaround is below (or here, though I suspect this is just papering over an upstream problem in a function where None should be returned, and instead it's getting wrapped as a byte array.
@property
def exif_thumbnail(self):
""" EXIF thumbnail.
:return: EXIF thumbnail in JPEG format
:rtype: str
"""
try:
thumb = lib.Exif(self.data).thumbnail
if len(thumb) == 0:
return None
return JPEGImage(blob=thumb)
except lib.ExifException:
return None
The text was updated successfully, but these errors were encountered:
Thanks for your work on this library.
I ran into a problem when trying to use it with images that had no EXIF thumbnail—instead of
lib.Exif(self.data).thumbnail
being set toNone
, it's a zero-length byte array. So when theexif_thumbnail()
function runs, it errors out because constructingJPEGImage(blob=None)
is gonna throw an error.A workaround is below (or here, though I suspect this is just papering over an upstream problem in a function where
None
should be returned, and instead it's getting wrapped as a byte array.The text was updated successfully, but these errors were encountered: