more fixes

This commit is contained in:
Tanishq Dubey 2025-03-15 20:01:07 -04:00
parent f12247b0b1
commit 23ce3be362

@ -30,12 +30,13 @@ def generate_thumbnail(image_path, resize_percent, min_width, max_width):
try: try:
exif = img.info['exif'] exif = img.info['exif']
orientation = img._getexif().get(0x0112, 1) # 0x0112 is the EXIF orientation tag orientation = img._getexif().get(0x0112, 1) # 0x0112 is the EXIF orientation tag
print(f"EXIF orientation: {orientation}, {image_path}")
if orientation == 3: if orientation == 3:
img = img.rotate(180, expand=True) img = img.rotate(180, expand=True)
elif orientation == 6: elif orientation == 6:
img = img.rotate(270, expand=True) img = img.rotate(270, expand=True)
elif orientation == 8: elif orientation == 8:
img = img.rotate(270 expand=True) img = img.rotate(270, expand=True)
except (AttributeError, KeyError, IndexError): except (AttributeError, KeyError, IndexError):
# cases: image don't have getexif # cases: image don't have getexif
exif = {} exif = {}