mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-11 17:56:18 +03:00
better fix for #15 (with a test case now)
This commit is contained in:
parent
ee794e1501
commit
a71183dab5
|
@ -378,7 +378,7 @@ class JpegImageFile(ImageFile.ImageFile):
|
|||
# process dictionary
|
||||
info = TiffImagePlugin.ImageFileDirectory(head)
|
||||
info.load(file)
|
||||
for key, value in list(info.items()):
|
||||
for key, value in info.items():
|
||||
exif[key] = fixup(value)
|
||||
# get exif extension
|
||||
try:
|
||||
|
@ -388,7 +388,7 @@ class JpegImageFile(ImageFile.ImageFile):
|
|||
else:
|
||||
info = TiffImagePlugin.ImageFileDirectory(head)
|
||||
info.load(file)
|
||||
for key, value in list(info.items()):
|
||||
for key, value in info.items():
|
||||
exif[key] = fixup(value)
|
||||
# get gpsinfo extension
|
||||
try:
|
||||
|
@ -399,7 +399,7 @@ class JpegImageFile(ImageFile.ImageFile):
|
|||
info = TiffImagePlugin.ImageFileDirectory(head)
|
||||
info.load(file)
|
||||
exif[0x8825] = gps = {}
|
||||
for key, value in list(info.items()):
|
||||
for key, value in info.items():
|
||||
gps[key] = fixup(value)
|
||||
return exif
|
||||
|
||||
|
|
|
@ -269,6 +269,11 @@ class ImageFileDirectory(collections.MutableMapping):
|
|||
def __iter__(self):
|
||||
return itertools.chain(self.tags.__iter__(), self.tagdata.__iter__())
|
||||
|
||||
def items(self):
|
||||
keys = list(self.__iter__())
|
||||
values = [self[key] for key in keys]
|
||||
return zip(keys, values)
|
||||
|
||||
# load primitives
|
||||
|
||||
load_dispatch = {}
|
||||
|
|
|
@ -177,3 +177,8 @@ def test_truncated_jpeg():
|
|||
assert_no_exception(lambda: test(4))
|
||||
assert_no_exception(lambda: test(8))
|
||||
assert_exception(IOError, lambda: test(10))
|
||||
|
||||
def test_exif():
|
||||
im = Image.open("Tests/images/pil_sample_rgb.jpg")
|
||||
info = im._getexif()
|
||||
assert_equal(info[305], 'Adobe Photoshop CS Macintosh')
|
||||
|
|
Loading…
Reference in New Issue
Block a user