Skip to content

Commit

Permalink
Merge pull request #6735 from radarhere/mpformatversion
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Nov 13, 2022
2 parents 2e2b7b6 + af317a6 commit 759b030
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Tests/test_file_mpo.py
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/PIL/MpoImagePlugin.py
Expand Up @@ -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())
Expand All @@ -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""
Expand Down

0 comments on commit 759b030

Please sign in to comment.