GIF generation file size

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
Zarx

GIF generation file size

Post by Zarx »

Hello everybody

I just find Image Magick and I think it is exactly what I want but I have a little problem which can be easily solve I think.

I have 33 JPG files, 20 Ko each and I use

Code: Select all

convert -delay 100 -loop 0 *.jpg mygif.gif
and "mygif.gif" is 5,5 Mo :shock:

33 x 20 Ko = 660 Ko + gif stuff I thought it should be something like 1 Mo for the gif... But 5 Mo !

I just read the doc and find -coalesce, -layers optimize but it didn't go under 5 Mo.

Could you please give me some advice to create a gif with a descent file size ?

Thx a lot
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: GIF generation file size

Post by anthony »

JPEG images are highly compressed using a lossy algorithm that is designed for real world images. Such images have huge numbers of colors and over very large, compared to the size of the disk file used.

They do not convert well to GIF which uses a lossless compressed raster with a 256 color limit. The limited colors (especially for large images require the use of dithering to produce a reasonable result. Also the default dithering method is error correction dither which generally works well for individual images, but does not optimize well when used in frame/compression optimization techniques needed for for GIF animations.

HOWEVER, all is NOT lost. I suggest you look at Video Handling in IM examples that has a specific techniques for producing better optimizations for GIF animations of real images. Also Look at GIF Animation Optimizations for more specific methods, though these go deeper am don't always work as well for real image animations.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Zarx

Re: GIF generation file size

Post by Zarx »

Thx a lot, your links are awsome :)
Post Reply