Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reduce the dimensions of gif images with ImageMagick?

Tags:

imagemagick

What flag in magick.exe convert <flags> will reduce the dimensions of my image?

This is the command I'm using: magick.exe input.png[0] -depth 8 -type Grayscale -dresize 400x300.

The [0] after the source-image filename is meant to strip the first frame of any animated gifs.

How can I do reduce my output gif sizes? My file sizes are too large: my outputs need to be less than 100k. Any methods other than reducing the dimensions are also welcome.

like image 816
dan Avatar asked Dec 20 '11 16:12

dan


People also ask

Can you scale a GIF?

How to resize the animated GIF? Click the Browse... button to select the GIF. In the Resize GIF section, enter its new dimensions in the Width and Height fields. To change the GIF proportion, unselect the Lock aspect ratio option.

Can you resize GIF without losing quality?

GIF Resizer is a free and user-friendly GIF resizer for Windows. It allows you to maintain the aspect ratio and quality of the output GIF while resizing GIF.


2 Answers

convert test.gif -fuzz 10% -layers Optimize result.gif 

Adding a -fuzz 2% produced a better optimization, but still not very good. At -fuzz 15% It isolated the differences for frame optimization to just the visible color band changes I noted before. At 25% the differences were almost to just the text changes.

Finally at a massive 30% fuzz factor (ignore color changes below that figure, did it optimize to just the text changes.

like image 127
Le Ding Avatar answered Sep 28 '22 15:09

Le Ding


You can try gifsicle:

gifsicle -O3 old.gif -o new.gif 

If it's an animation, you could try skipping frames (see how it works).

like image 27
Martin Thoma Avatar answered Sep 28 '22 16:09

Martin Thoma