29
6
How to compress GIF animations? For example by reducing the color index.
The files are generated using Imagemagick but optimization seems complicated.
For example, the following animation is 864KB at 150x119:
To be used on a Linux machine.
29
6
How to compress GIF animations? For example by reducing the color index.
The files are generated using Imagemagick but optimization seems complicated.
For example, the following animation is 864KB at 150x119:
To be used on a Linux machine.
43
Use gifsicle (available for Mac OS X, Windows, DOS, Debian, FreeBSD and NetBSD).
gifsicle -i anim.gif -O3 --colors 256 -o anim-opt.gif
This will optimize and reduce to 256 colors, if the animation uses more colors (the example image does).
You can reduce the size by reducing the number of colors:
Based on another Q&A.
1Thanks for your answer. It helped me a lot. I got the best result using gifsicle -i anim.gif --optimize=3 -o anim-opt.gif
– Mostafa Ahangarha – 2017-11-21T12:50:30.320
works great! for some odd reason, im using a shell script that uses imagemagick and oddly it isnt working with gifs we got from videos via final cut pro (exported as image sequence) then exported thru photoshop but otherwise works on other gifs. – SMT – 2017-11-30T18:56:15.830
Available in FreeBSD ports as well: https://www.freshports.org/graphics/gifsicle/
– Mateusz Piotrowski – 2018-09-16T15:55:38.603Could you explain what the -03 means? – Jacob – 2019-12-19T04:41:42.217
See also Is there something like pngcrush for GIFs? on Stack Overflow for more answers.
– user – 2019-05-06T09:36:32.990