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

Do not modify previous frame when calculating delta in PNG #6683

Merged
merged 1 commit into from Oct 24, 2022

Conversation

radarhere
Copy link
Member

Helps the original code in #6672

When iterating through frames to save a PNG, the following code

if prev_disposal == Disposal.OP_BACKGROUND:
base_im = previous["im"]
dispose = Image.core.fill("RGBA", im.size, (0, 0, 0, 0))
bbox = previous["bbox"]
if bbox:
dispose = dispose.crop(bbox)
else:
bbox = (0, 0) + im.size
base_im.paste(dispose, bbox)

actually changing the previous frame with the paste operation.

This PR fixes that by making base_im a copy() instead.

@hugovk hugovk merged commit a77eb67 into python-pillow:main Oct 24, 2022
60 checks passed
@radarhere radarhere deleted the apng branch October 24, 2022 21:18
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.

None yet

2 participants