1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 23:02:26 +00:00

update get image's exif info function

This commit is contained in:
lian
2016-09-05 13:48:19 +08:00
parent 66a3e82e04
commit 2fc5aa0859

View File

@@ -27,19 +27,12 @@ def get_rotated_image(image):
# get image's exif info
exif = {}
if image._getexif():
exif = {
ExifTags.TAGS[k]: v
for k, v in image._getexif().items()
if k in ExifTags.TAGS
}
# get Orientation info from exif
if exif.has_key('Orientation'):
orientation = exif['Orientation']
else:
orientation = 1
try:
exif = image._getexif()
except Exception:
return image
orientation = exif.get(0x0112)
# rotate image according to Orientation info
if orientation == 2:
# Vertical image