Mercurial > public > sg101
diff core/image.py @ 891:24fc302f9076
Work around Pillow IndexError on certain images.
See Issue #82.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 16 Feb 2015 18:58:49 -0600 |
parents | 36d988b800c2 |
children |
line wrap: on
line diff
--- a/core/image.py Mon Feb 16 18:39:33 2015 -0600 +++ b/core/image.py Mon Feb 16 18:58:49 2015 -0600 @@ -102,7 +102,13 @@ """ if hasattr(im, '_getexif'): - exif = im._getexif() + try: + exif = im._getexif() + except IndexError: + # Work around issue seen in Pillow + # https://github.com/python-pillow/Pillow/issues/518 + exif = None + if exif and ORIENT_TAG in exif: orientation = exif[ORIENT_TAG] func = ORIENT_FUNCS.get(orientation)