Skip to content

Image.show() defaults to PNG ignoring animated GIFs #6608

@seidnerj

Description

@seidnerj

When using show() for an animated GIF with version 9.2.0, Pillow converts the 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions