Skip to content

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.

@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

3 participants