A
A
alpust2012-11-06 18:12:09
linux
alpust, 2012-11-06 18:12:09

Reducing gif images (height and width twice) leads to an increase in file weight by 10%

I try under unix using imagemagick to reduce the size of gif images, for example from 400x400 to 150x150 in most cases, the file weight increases after conversion by 10%. I try this command, with the addition of various optimization filters, but it still does not help:

convert n9H6d1304MgaeL2.gif -coalesce -thumbnail 190x190 -layers Optimize test190.gif
gifsicle -O2 test190.gif > test190.gif

Can someone tell me what the problem might be and /or open source libraries that are able to qualitatively reduce and then optimize gif?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
Z
ZimM, 2012-11-06
@ZimM

I suspect that the whole point is that the original image has a small number of colors, and after resizing the palette immediately grows and, accordingly, the file size also increases

D
demimurych, 2012-11-06
@demimurych

ImageMagick is a very complex tool that you need to know how to use.
Your original gif has 153 colors per frame.
By simply using convert without specifying a palette, you get 256 colors per frame. This explains the increase in file size
. Unfortunately, I'm not so good at ImgeMagick to teach it to do automatically the best option for your task.
Therefore, I recommend using gifsicle for these purposes
gifsicle -O4 --resize 190x190 ./test.gif -o ./test2.gif

V
vsespb, 2012-11-06
@vsespb

Use the option ' +profile "*" '

convert +profile "*"…

This will get rid of a large piece of metadata written to the file.

D
demimurych, 2012-11-06
@demimurych

gifsicle -O2 --resize 190x190 ./test.gif -o ./test2.gif

D
demimurych, 2012-11-06
@demimurych

In addition, gifsicle has a --colors parameter in which you can manually select the number of colors that suit you
, for example, with your gifsicle file
-O4 --resize 190x190 --colors 100 ./test.gif -o ./test2.gif
gives the result is 1.5Mb with apparently similar quality.

A
alpust, 2012-11-07
@alpust

In general, yes, the problem was in the palette, the gifcycle is not even needed, you can also set the palette in the envelope, the working version:
convert 81204073_0_b4769_4532d6eb_XL.gif -coalesce -thumbnail 190x190 -layers Optimize -colors 100 test190.gif
from 1.9 reduces to 1.5. Thanks to all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question