From b82d3107dc2dbeff521d50cd86d85e0e5f405a80 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Wed, 3 Aug 2022 18:00:02 +1000 Subject: [PATCH] fix BUG-104 by only calling exif auto trans on jpegs, not all images --- shared.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/shared.py b/shared.py index 36dcf59..8aa4c21 100644 --- a/shared.py +++ b/shared.py @@ -121,9 +121,13 @@ def SymlinkName(ptype, path, file): def GenThumb(fname,auto_rotate): try: if auto_rotate: - # run cmdline util to re-orient jpeg (only changes if needed, and does it losslessly) - p = subprocess.run([PA_EXIF_ROTATER,fname] ) - im=Image.open(fname) + im_orig = Image.open(fname) + if im_orig.format == 'JPEG': + # run cmdline util to re-orient jpeg (only changes if needed, and does it losslessly) + p = subprocess.run([PA_EXIF_ROTATER,fname] ) + im=Image.open(fname) + else: + im=im_orig # if we don't autorotate/touch the original, we still want the thumbnail oriented the right way else: im_orig = Image.open(fname)