Skip to content

Conversation

@radarhere
Copy link
Member

Resolves #9358

Currently, APNG images round durations to an integer when saving.

frame_duration = int(round(encoderinfo.get("duration", 0)))

This isn't necessary, as we are writing the numerator and denominator to the image. This PR allows floats to be used instead.

I also raise an error if the duration is too large to be expressed with a 2 byte numerator.

@hugovk hugovk merged commit b2d9bc3 into python-pillow:main Jan 1, 2026
56 checks passed
@radarhere radarhere deleted the apng_duration branch January 1, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

apng duration returns float instead of int

2 participants