Skip to content

Use disposal settings from previous frame in APNG#5126

Merged
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:apng_disposal
Dec 31, 2020
Merged

Use disposal settings from previous frame in APNG#5126
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:apng_disposal

Conversation

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

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.

APNG conversion issue

2 participants