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:
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user