Added MP Format Version when saving

This commit is contained in:
Andrew Murray 2022-11-13 08:00:20 +11:00
parent b617943dca
commit af317a696d
2 changed files with 3 additions and 1 deletions

View File

@ -268,6 +268,7 @@ def test_save_all():
im_reloaded = roundtrip(im, save_all=True, append_images=[im2])
assert_image_equal(im, im_reloaded)
assert im_reloaded.mpinfo[45056] == b"0100"
im_reloaded.seek(1)
assert_image_similar(im2, im_reloaded, 1)

View File

@ -51,7 +51,7 @@ def _save_all(im, fp, filename):
if not offsets:
# APP2 marker
im.encoderinfo["extra"] = (
b"\xFF\xE2" + struct.pack(">H", 6 + 70) + b"MPF\0" + b" " * 70
b"\xFF\xE2" + struct.pack(">H", 6 + 82) + b"MPF\0" + b" " * 82
)
JpegImagePlugin._save(im_frame, fp, filename)
offsets.append(fp.tell())
@ -60,6 +60,7 @@ def _save_all(im, fp, filename):
offsets.append(fp.tell() - offsets[-1])
ifd = TiffImagePlugin.ImageFileDirectory_v2()
ifd[0xB000] = b"0100"
ifd[0xB001] = len(offsets)
mpentries = b""