mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 14:50:29 +00:00
update get image's exif info function
This commit is contained in:
@@ -27,19 +27,12 @@ def get_rotated_image(image):
|
|||||||
|
|
||||||
# get image's exif info
|
# get image's exif info
|
||||||
exif = {}
|
exif = {}
|
||||||
if image._getexif():
|
try:
|
||||||
exif = {
|
exif = image._getexif()
|
||||||
ExifTags.TAGS[k]: v
|
except Exception:
|
||||||
for k, v in image._getexif().items()
|
return image
|
||||||
if k in ExifTags.TAGS
|
|
||||||
}
|
|
||||||
|
|
||||||
# get Orientation info from exif
|
|
||||||
if exif.has_key('Orientation'):
|
|
||||||
orientation = exif['Orientation']
|
|
||||||
else:
|
|
||||||
orientation = 1
|
|
||||||
|
|
||||||
|
orientation = exif.get(0x0112)
|
||||||
# rotate image according to Orientation info
|
# rotate image according to Orientation info
|
||||||
if orientation == 2:
|
if orientation == 2:
|
||||||
# Vertical image
|
# Vertical image
|
||||||
|
Reference in New Issue
Block a user