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

Use disposal settings from previous frame in APNG #5126

Merged
merged 1 commit into from Dec 31, 2020

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Dec 23, 2020

Helps the APNG part of #5032. Alternative to #5071

Resolves #4657

At the moment, self.dispose_op and self.dispose_extent are set in _seek,

self.dispose_op = self.info.get("disposal")
self.blend_op = self.info.get("blend")
self.dispose_extent = self.info.get("bbox")

and then used in _load_end

if self.dispose_op == APNG_DISPOSE_OP_PREVIOUS:
dispose = self._prev_im.copy()
dispose = self._crop(dispose, self.dispose_extent)
elif self.dispose_op == APNG_DISPOSE_OP_BACKGROUND:
dispose = Image.core.fill(self.im.mode, self.size)
dispose = self._crop(dispose, self.dispose_extent)
else:
dispose = None

This should not be the case, as the specification states that

dispose_op specifies how the output buffer should be changed at the end of the delay (before rendering the next frame).

It controls how the contents of the current frame should be disposed when moving on to the next frame. It is not something to be immediately applied.

This PR corrects that.

@radarhere radarhere mentioned this pull request Dec 24, 2020
@hugovk hugovk merged commit 4093897 into python-pillow:master Dec 31, 2020
50 checks passed
@radarhere radarhere deleted the apng_disposal branch Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants