Skip to content

Commit a063750

Browse files
authored
Fix exif orientation in thumbnail (fixes #323) (#324)
1 parent 76e241b commit a063750

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

gramps_webapi/api/image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ def image_thumbnail(image: Image, size: int, square: bool = False) -> Image:
4040
4141
If `square` is true, the image is cropped to a centered square.
4242
"""
43+
img = ImageOps.exif_transpose(image)
4344
if square:
4445
# don't enlarge image: square size is at most shorter (!) side's length
45-
size_orig = min(image.size)
46+
size_orig = min(img.size)
4647
size_square = min(size_orig, size)
4748
return ImageOps.fit(
48-
image,
49+
img,
4950
(size_square, size_square),
5051
bleed=0.0,
5152
centering=(0.5, 0.5),
5253
method=Image.BICUBIC,
5354
)
54-
img = image.copy()
5555
img.thumbnail((size, size))
5656
return img
5757

0 commit comments

Comments
 (0)