Move ORIENTATION_KEY to global.

master
voussoir 2021-05-30 21:34:29 -07:00
parent eeba8c1197
commit 96a0e177e6
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 7 additions and 5 deletions

View File

@ -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( def fit_into_bounds(
image_width, image_width,
image_height, image_height,
@ -31,11 +38,6 @@ def rotate_by_exif(image):
''' '''
# Thank you Scabbiaza # Thank you Scabbiaza
# https://stackoverflow.com/a/26928142 # https://stackoverflow.com/a/26928142
import PIL.ExifTags
for (ORIENTATION_KEY, val) in PIL.ExifTags.TAGS.items():
if val == 'Orientation':
break
try: try:
exif = image._getexif() exif = image._getexif()