Fix gallery thumbnail creation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user