Skip to content

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Jun 4, 2024

Resolves #8102

When saving APNG images, if there is no duration argument given to the save() command, then duration is pulled from the first image's info dictionary.

def _write_multiple_frames(im, fp, chunk, rawmode, default_image, append_images):
duration = im.encoderinfo.get("duration", im.info.get("duration", 0))

That value is later re-used for subsequent frames, leading to the unexpected behaviour in the issue.

if "duration" not in encoderinfo:
encoderinfo["duration"] = duration

This PR corrects this, using GifImagePlugin's _write_multiple_frames() as a model.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has a conflict.

@hugovk hugovk merged commit a4188bb into python-pillow:main Jun 25, 2024
@radarhere radarhere deleted the apng branch June 25, 2024 20:08
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.

Saving to apng has wrong durations

2 participants