Fix meta error

This commit is contained in:
Sewon Ahn 2020-12-11 21:35:56 +09:00
parent 149890f2eb
commit a6c932b961

View file

@ -39,13 +39,18 @@ def thumbnail(image, name, args):
try:
size = (450, 450)
im = Image.open(image)
exif = None
try:
for orientation in ExifTags.TAGS.keys():
if ExifTags.TAGS[orientation] == 'Orientation':
break
exif = im._getexif()
except (AttributeError, KeyError, IndexError):
pass
im.thumbnail(size)
if exif is not None:
if exif[orientation] == 3:
im = im.rotate(180, expand=True)
elif exif[orientation] == 6: