Mercurial > public > sg101
comparison core/image.py @ 893:3aecf9058130
Merge with upstream.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 17 Feb 2015 18:59:06 -0600 |
parents | 24fc302f9076 |
children |
comparison
equal
deleted
inserted
replaced
889:ae146e30d588 | 893:3aecf9058130 |
---|---|
100 was oriented and False otherwise. image is either a new transformed image or | 100 was oriented and False otherwise. image is either a new transformed image or |
101 the original image instance. | 101 the original image instance. |
102 | 102 |
103 """ | 103 """ |
104 if hasattr(im, '_getexif'): | 104 if hasattr(im, '_getexif'): |
105 exif = im._getexif() | 105 try: |
106 exif = im._getexif() | |
107 except IndexError: | |
108 # Work around issue seen in Pillow | |
109 # https://github.com/python-pillow/Pillow/issues/518 | |
110 exif = None | |
111 | |
106 if exif and ORIENT_TAG in exif: | 112 if exif and ORIENT_TAG in exif: |
107 orientation = exif[ORIENT_TAG] | 113 orientation = exif[ORIENT_TAG] |
108 func = ORIENT_FUNCS.get(orientation) | 114 func = ORIENT_FUNCS.get(orientation) |
109 if func: | 115 if func: |
110 return (True, func(im)) | 116 return (True, func(im)) |