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)