imjerdev
imjerdev

Reputation: 123

Best way to compress animated GIFs using ImageMagick, without using Gifsicle

So my web host won't install gifsicle on their shared servers, so I'm stuck with ImageMagick. I want to compress the images like it is here: https://pornel.net/lossygif how can I do that without using gifsicle; using only ImageMagick?

Right now my exec() command goes like:

exec("convert $animation -coalesce -gravity SouthWest  -geometry +0+0 null: $watermark -layers composite -layers optimize $animation");

and the watermarked GIF barely compresses, and sometimes it even gets larger. How could I solve this issue?

Upvotes: 11

Views: 21697

Answers (2)

dcoffey3296
dcoffey3296

Reputation: 2594

I had success with ImageMagick's Mogrify: https://www.imagemagick.org/script/mogrify.php

After you generate a large gif, you can make it smaller.

My command looked like:

mogrify -layers 'optimize' -fuzz 7% mygif.gif

The -layers option optimized any layers in your gif

The biggest space savings comes from the -fuzz option, which specifies that colors within a certain tolerance can be considered the same color.

My several second gifs went from 3 MB to a few hundred kb.

Upvotes: 28

Kristian
Kristian

Reputation: 2505

converts gif files online without code.

http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi


If you want to use code why not use

-quality 80% old.gif new.gif

This should reduce the file size


Answer taken from:

How can I compress the size of gif images with ImageMagick?

https://stackoverflow.com/questions/8578926/how-can-i-compress-the-size-of-gif-images-with-imagemagick

Upvotes: -5

Related Questions