Skip to content

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

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:apng
Oct 24, 2022
Merged

Do not modify previous frame when calculating delta in PNG#6683
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:apng

Conversation

@radarhere
Copy link
Copy Markdown
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.

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.

2 participants