# HG changeset patch # User Brian Neal # Date 1424134729 21600 # Node ID 24fc302f9076ce869aa8d9cfce34ffdc7b68064f # Parent df09f327e1b9e432d4f95396fea8af9b728e906a Work around Pillow IndexError on certain images. See Issue #82. diff -r df09f327e1b9 -r 24fc302f9076 core/image.py --- 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)