Fix saving MPO with more than one appended image#8979
Merged
hugovk merged 4 commits intopython-pillow:mainfrom Jun 28, 2025
Merged
Fix saving MPO with more than one appended image#8979hugovk merged 4 commits intopython-pillow:mainfrom
hugovk merged 4 commits intopython-pillow:mainfrom
Conversation
hugovk
reviewed
Jun 27, 2025
hugovk
reviewed
Jun 27, 2025
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Merged
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #8977
With each new frame that is saved to an MPO image, an offset is added
Pillow/src/PIL/MpoImagePlugin.py
Lines 65 to 68 in 086e05f
leading to a longer
mpentriesPillow/src/PIL/MpoImagePlugin.py
Line 81 in 086e05f
meaning the IFD becomes longer
Pillow/src/PIL/MpoImagePlugin.py
Line 85 in 086e05f
We rewind and replace the placeholder data with the IFD
Pillow/src/PIL/MpoImagePlugin.py
Lines 87 to 89 in 086e05f
But the placeholder data only ever has the same number of bytes, regardless of the number of frames.
Pillow/src/PIL/MpoImagePlugin.py
Line 55 in 086e05f
This PR increases the length of the placeholder data as the number of frames increase.