Fix gallery thumbnail creation

This commit is contained in:
2023-03-23 19:43:00 +01:00
parent 294bffdef4
commit 5c1d62c9f6

View File

@@ -74,17 +74,7 @@ def create_thumbs(folder_path):
with Image.open(str(image_path), "r") as image: with Image.open(str(image_path), "r") as image:
if image._getexif() is not None: if image._getexif() is not None:
for orientation in ExifTags.TAGS.keys(): image = ImageOps.exif_transpose(image)
if ExifTags.TAGS[orientation] == "Orientation":
break
exif = dict(image._getexif().items())
if exif[orientation] == 3:
image = image.rotate(180, expand=True)
elif exif[orientation] == 6:
image = image.rotate(270, expand=True)
elif exif[orientation] == 8:
image = image.rotate(90, expand=True)
thumb = ImageOps.fit(image, size, Image.ANTIALIAS) thumb = ImageOps.fit(image, size, Image.ANTIALIAS)
thumb.save(thumb_file_path) thumb.save(thumb_file_path)