Image.show() defaults to PNG ignoring animated GIFs
When using show() for an animated GIF with version 9.2.0, Pillow converts to image to PNG by default thus eliminating the animation.
I suggest the following change in "ImageShow.py" to preserve the animation:
def save_image(self, image):
"""Save to temporary file and return filename."""
if image.format == 'GIF' and image.is_animated:
suffix = "." + image.format
f, filename = tempfile.mkstemp(suffix)
os.close(f)
image.save(filename, save_all=True)
return filename
else:
image_format = self.get_format(image)
return image._dump(format=image_format, **self.options)
PNG also supports multiple frames. If we were going to add this feature, I would recommend still using the PNG format, as GIF frames are limited to 256 colors.
I've created PR #6611 to do so, and PR #6610 to fix a problem when saving GIFs as animated PNGs.
Hehe, I was just faced with what you fixed in #6610 when I tried rewriting this to work as an animated PNG and was working to fix that :)
Nice! thanks a lot.