Pillow
Pillow copied to clipboard
Match mask size to pasted image size in GifImagePlugin
Resolves #7777
When looping through images to create a GIF image, the frames may be different sizes.
At the moment, this means that
https://github.com/python-pillow/Pillow/blob/1b6723967440cf8474a9bd1e1c394c90c5c2f986/src/PIL/GifImagePlugin.py#L671
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.