Skip to content

Match mask size to pasted image size in GifImagePlugin#7779

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:gif
Mar 1, 2024
Merged

Match mask size to pasted image size in GifImagePlugin#7779
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:gif

Conversation

@radarhere
Copy link
Member

Resolves #7777

When looping through images to create a GIF image, the frames may be different sizes.

At the moment, this means that

diff_frame.paste(fill, mask=ImageOps.invert(mask))

fill comes from the size of the new frame, whereas mask comes from ImageChops.subtract_modulo() between the new and the old frame.

This may cause a mismatch in size between the image being pasted and the mask, which can lead to an error.

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.

ValueError: images do not match

3 participants