Skip to content

Scaled animated GIFs are larger than the original #134

@davisagli

Description

@davisagli

We noticed that scaled animated GIFs can be larger (sometimes much larger) than the original file size.

This seems to be because the default LANCZOS resampling and conversion to a palette-based image gets in the way of optimizing the file when saving, because parts of the image that remained the same between frames are now recognized as different.

I've tested and found that using NEAREST resampling and processing all the frames of the animation as RGBA helps. The resulting image quality is not quite as good (no antialiasing) but the file size is much better. This seems like a reasonable tradeoff. I'll make a PR.

(Note: I could not find any way with Pillow to get as good results as with a dedicated tool like gifsicle.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions