Move ORIENTATION_KEY to global.
This commit is contained in:
parent
eeba8c1197
commit
96a0e177e6
1 changed files with 7 additions and 5 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue