mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 21:24:31 +03:00
Save base IFDs when converting Exif to bytes
This commit is contained in:
parent
faf8fad76d
commit
4b14f0102d
|
@ -752,6 +752,14 @@ class TestImage:
|
|||
4098: 1704,
|
||||
}
|
||||
|
||||
def test_exif_ifd(self):
|
||||
im = Image.open("Tests/images/flower.jpg")
|
||||
exif = im.getexif()
|
||||
|
||||
reloaded_exif = Image.Exif()
|
||||
reloaded_exif.load(exif.tobytes())
|
||||
assert reloaded_exif.get_ifd(0x8769) == exif.get_ifd(0x8769)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_module",
|
||||
[PIL, Image],
|
||||
|
|
|
@ -3371,6 +3371,8 @@ class Exif(MutableMapping):
|
|||
head = b"MM\x00\x2A\x00\x00\x00\x08"
|
||||
ifd = TiffImagePlugin.ImageFileDirectory_v2(ifh=head)
|
||||
for tag, value in self.items():
|
||||
if tag in [0x8769, 0x8225] and not isinstance(value, dict):
|
||||
value = self.get_ifd(tag)
|
||||
ifd[tag] = value
|
||||
return b"Exif\x00\x00" + head + ifd.tobytes(offset)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user