From 5c1d62c9f614019757917a4cef8d8564d41f4206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20B=C3=BChrle?= Date: Thu, 23 Mar 2023 19:43:00 +0100 Subject: [PATCH] Fix gallery thumbnail creation --- fet2020/gallery/utils.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/fet2020/gallery/utils.py b/fet2020/gallery/utils.py index 8ac7b21f..0df94d8c 100644 --- a/fet2020/gallery/utils.py +++ b/fet2020/gallery/utils.py @@ -74,17 +74,7 @@ def create_thumbs(folder_path): with Image.open(str(image_path), "r") as image: if image._getexif() is not None: - for orientation in ExifTags.TAGS.keys(): - 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) + image = ImageOps.exif_transpose(image) thumb = ImageOps.fit(image, size, Image.ANTIALIAS) thumb.save(thumb_file_path)