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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
stangogh@gmail.com
Posts: 1
Joined: 2017-10-30T12:59:03-07:00
Authentication code: 1151

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
Post Reply