From 96a0e177e65d9643199aae01c895d90bec37592b Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 30 May 2021 21:34:29 -0700 Subject: [PATCH] Move ORIENTATION_KEY to global. --- voussoirkit/imagetools.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/voussoirkit/imagetools.py b/voussoirkit/imagetools.py index bc53743..1ede548 100644 --- a/voussoirkit/imagetools.py +++ b/voussoirkit/imagetools.py @@ -1,3 +1,10 @@ +import PIL.ExifTags + +ORIENTATION_KEY = None +for (ORIENTATION_KEY, val) in PIL.ExifTags.TAGS.items(): + if val == 'Orientation': + break + def fit_into_bounds( image_width, image_height, @@ -31,11 +38,6 @@ def rotate_by_exif(image): ''' # Thank you Scabbiaza # https://stackoverflow.com/a/26928142 - import PIL.ExifTags - - for (ORIENTATION_KEY, val) in PIL.ExifTags.TAGS.items(): - if val == 'Orientation': - break try: exif = image._getexif()