Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed combining single duration across duplicate APNG frames #7146

Merged
merged 3 commits into from
Jun 6, 2023

Conversation

radarhere
Copy link
Member

Resolves #7144

When saving APNG files, we are testing that when duplicate frames are combined, the different durations are added together.

# test removal of duplicated frames
frame = Image.new("RGBA", (128, 64), (255, 0, 0, 255))
frame.save(
test_file, save_all=True, append_images=[frame, frame], duration=[500, 100, 150]
)
with Image.open(test_file) as im:
im.load()
assert im.n_frames == 1
assert im.info.get("duration") == 750

However, we aren't testing that the durations are combined when the duration keyword is a single number, rather than a list or a tuple. This issue found that this situation fails, and this PR corrects that.

@gsingh93
Copy link

I've been using a local build with this patch for a few weeks now and it's been working well, hopefully we can get this merged soon :)

@radarhere
Copy link
Member Author

Be aware that even if it is merged, Pillow 10.0.0 is not due out until July 1.

@gsingh93
Copy link

Yup, just looking forward to being able to remove the applying of these patches from my CI infrastructure and providing patching instructions to anyone who wants to run my code. I'm fine using master for now, other than that.

Tests/test_file_apng.py Outdated Show resolved Hide resolved
@hugovk hugovk added the automerge Automatically merge PRs that are ready label Jun 6, 2023
@mergify mergify bot merged commit 6b3991b into python-pillow:main Jun 6, 2023
@radarhere radarhere deleted the apng_duration branch June 6, 2023 08:57
@radarhere
Copy link
Member Author

Pillow 10.0.0 has now been released with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge PRs that are ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Animated PNG filters out similar frames without adjusting frame rate
3 participants