Merge pull request #6735 from radarhere/mpformatversion

This commit is contained in:
Hugo van Kemenade 2022-11-13 19:51:20 +02:00 committed by GitHub
commit 759b0301b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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]) im_reloaded = roundtrip(im, save_all=True, append_images=[im2])
assert_image_equal(im, im_reloaded) assert_image_equal(im, im_reloaded)
assert im_reloaded.mpinfo[45056] == b"0100"
im_reloaded.seek(1) im_reloaded.seek(1)
assert_image_similar(im2, im_reloaded, 1) assert_image_similar(im2, im_reloaded, 1)

View File

@ -51,7 +51,7 @@ def _save_all(im, fp, filename):
if not offsets: if not offsets:
# APP2 marker # APP2 marker
im.encoderinfo["extra"] = ( 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) JpegImagePlugin._save(im_frame, fp, filename)
offsets.append(fp.tell()) offsets.append(fp.tell())
@ -60,6 +60,7 @@ def _save_all(im, fp, filename):
offsets.append(fp.tell() - offsets[-1]) offsets.append(fp.tell() - offsets[-1])
ifd = TiffImagePlugin.ImageFileDirectory_v2() ifd = TiffImagePlugin.ImageFileDirectory_v2()
ifd[0xB000] = b"0100"
ifd[0xB001] = len(offsets) ifd[0xB001] = len(offsets)
mpentries = b"" mpentries = b""