This commit is contained in:
Andrew Murray 2015-09-10 11:19:47 +00:00
commit 69ad104c5f
3 changed files with 7 additions and 1 deletions

View File

@ -423,7 +423,7 @@ def _getexif(self):
# get exif extension # get exif extension
try: try:
file.seek(exif[0x8769]) file.seek(exif[0x8769])
except KeyError: except (KeyError, TypeError):
pass pass
else: else:
info = TiffImagePlugin.ImageFileDirectory(head) info = TiffImagePlugin.ImageFileDirectory(head)

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@ -166,6 +166,12 @@ class TestFileJpeg(PillowTestCase):
im = hopper() im = hopper()
im.save(f, 'JPEG', quality=90, exif=b"1"*65532) im.save(f, 'JPEG', quality=90, exif=b"1"*65532)
def test_exif_typeerror(self):
im = Image.open('Tests/images/exif_typeerror.jpg')
# Should not raise a TypeError
im._getexif()
def test_progressive_compat(self): def test_progressive_compat(self):
im1 = self.roundtrip(hopper()) im1 = self.roundtrip(hopper())
im2 = self.roundtrip(hopper(), progressive=1) im2 = self.roundtrip(hopper(), progressive=1)