Skip to content

Resizing animated gifs result in Image too large error #69

@marcduiker

Description

@marcduiker

I finally figured out what went wrong with the resizing of images in my fork.

Currently, the resizing process doesn't handle large (many frames) animated gifs well when it also includes jpg as an output format. Each frame of the gif is vertically stacked into the jpg output, making it too large to handle.

Temporary solution: For now, I've limited the output types to only use webp to avoid the unnecessary stacked jpg output. The sharpOptions include animated to enable animated webp output, and I've set the limitInputPixels to be 100x larger than the default option, but this really depends on the size & length of the gif animations.

Suggested solutions:

  1. Don't use jpg output at all for animated file types, even when this is included in the output formats.
  2. Use conditional output formats per input file type: still image -> ['webp', 'jpg'], animated image -> ['webp', 'gif']

I hope this provides enough context for you. Perhaps the solution needs to be somewhere upstream instead of this template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions