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)