Sharp: Does gif support compression

Created on 8 Oct 2020  路  3Comments  路  Source: lovell/sharp

As per documentation 'https://sharp.pixelplumbing.com/api-output#gif' I couldn' find any quality parameter as we see for png.jpg etc.

question

Most helpful comment

Thanks, if you require the features of gifsicle then that's probably the right tool for the job.

(In my experience, the best way to optimise a GIF image is to convert it to pretty much any other format.)

All 3 comments

I'm unsure if a quality setting makes sense for GIF - it's going to be terrible quality regardless - nor am I sure what exactly that would control. Are you able to provide an example of another GIF encoder that provides such a setting?

I thought GIF is basically a set of frames/images, so we could optimize each image and then combine them together. But after looking into it, seems like it is harder and maybe not reliable
From https://davidwalsh.name/optimize-gifs I learnt there could be 3 optimization levels.
In https://ezgif.com/ I could reduce a gif from 2mb to 1.7mb at compression level 112 (level till 200)
They use gifsicle gifsicle -O3 --lossy=112 -o lossy-compressed.gif input.gif

Thanks, if you require the features of gifsicle then that's probably the right tool for the job.

(In my experience, the best way to optimise a GIF image is to convert it to pretty much any other format.)

Was this page helpful?
0 / 5 - 0 ratings