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:
@@ -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
|
||||
|
Reference in New Issue
Block a user