Skip to content

Conversation

@radarhere
Copy link
Member

Helps #2239

The first frame of the GIF from the issue (and in the GIF that I've created for this PR) has disposal method 3.

https://www.w3.org/Graphics/GIF/spec-gif89a.txt

3 - Restore to previous. The decoder is required to restore the area overwritten by the graphic with what was there prior to rendering the graphic.

At the moment, we only handle disposal method 3 for frames after the first frame.

# replace with previous contents
if self.im:
# only dispose the extent in this frame
self.dispose = self._crop(self.im, self.dispose_extent)
except (AttributeError, KeyError):

This means that disposal method 3 for the first frame is treated as disposal 0 ("No disposal specified. The decoder is not required to take any action.") or disposal 1 ("Do not dispose. The graphic is to be left in place.") instead.

So since "what was there prior to rendering the graphic" is... nothing... this PR attempts to treat the previous contents of the first frame as being transparent instead.

@radarhere radarhere added the GIF label Apr 8, 2021
@radarhere radarhere changed the title Treat previous contents of first frame as transparent Treat previous contents of GIF first frame as transparent Apr 8, 2021
@radarhere radarhere changed the title Treat previous contents of GIF first frame as transparent Treat previous contents of first GIF frame as transparent Apr 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants