Conversation
When saving an APNG, a frame duration whose fractional delay has a numerator over the 16-bit fcTL limit raised ValueError instead of saving. The duration is now split across consecutive identical frames, each with a delay that fits, so the animation replays the full duration
Member
|
I've created #10070 as an alternative that I think is simpler. See what you think. |
Contributor
Author
|
Agreed, yours is simpler and it also keeps the animation where the split approach loses it: two identical frames with something like [32768000, 32768000] combine into a single frame and the existing one-frame short-circuit writes a static PNG, while #10070 keeps both frames. Closing in favour of #10070 |
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.
Fixes #10063. Alternative to #10070
Saving an APNG with a frame duration whose fractional delay has a numerator over the 16-bit fcTL limit raised
ValueError: cannot write durationinstead of saving, even when the individual frame delays were representable — the merge of identical consecutive frames can push a summed duration over the limit (the example from the issue: two identical frames withduration=[32768, 32769]merge into a single 65537 ms frame that no longer fits).Following the direction from #10063 (comment), the duration is now split across consecutive identical frames, each with a delay that fits, so the animation replays the full duration. The split only triggers when a delay doesn't fit, and the total duration is preserved exactly.