Page 1 of 1

Convert generates large.gif file size from images with small sizes.

Posted: 2017-10-30T13:05:59-07:00
by stangogh@gmail.com
I'm using convert to generate an animated gif from 33 jpgs of size 520x293
The command I'm using is:
convert -quiet -delay 1x24 -loop 0 *.jpg animation.gif

The file sizes of the 33 jpgs are all around 38kb, but the output gif is 4.8 gb. What could be the cause?

For reference, the images I'm using to generate the gif can be downloaded here:
https://oveddan.github.io/blog/images/jpegs.zip
and the resulting gif is here:
https://oveddan.github.io/blog/images/d ... rope_a.gif

Re: Convert generates .gif large file size from small files.

Posted: 2017-10-30T13:11:16-07:00
by fmw42
Please always provide your IM version and platform when asking questions, since syntax may vary.

Try

Code: Select all

convert -quiet -delay 1x24 *.jpg -loop 0  -layers optimize animation.gif
But that may not optimize as much as you want. The issue is that each jpg has different colors that have to to be quantized. Even after quantization, each gif frame will still have different colormaps for its 256 colors (i.e. different sets of 256 colors). So to really get the best file size you should make every image have the same colortable. You can do that by using -remap on each jpg to convert to gif, then combine all the gifs. Unfortunately, you will have to loop over each jpg to use -remap, since it only remaps one image at a time. But you could use mogrify to process all the jpg into gifs using -remap. See http://www.imagemagick.org/Usage/quantize/#remap