Less weight

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
lleoun

Less weight

Post by lleoun »

Hi all,

I'm doing this:

$cmd = "convert -delay 300 -loop 0 ".$path."*.jpg ".$path."final.gif";
exec($cmd,$erroer);

And the result is great but for the weight: 500kb, what is way too heavy for a gif :((
How can I lighten the gif?

Thanks a ton!!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Less weight

Post by fmw42 »

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

Re: Less weight

Post by anthony »

A JPG is a single image. Most GIF optimizations are for multi-image GIF, which are typically (not always) animations.

For single image GIF is a pallette image and is not really designed for LARGE images but small 'cartoon' or 'limited color' images like icons, and diagrams. If you are converting a large photo -- the result will be large and generally not very good looking!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
lleoun

Re: Less weight

Post by lleoun »

Please, don't tell me that there's no solution .. I've built a whole project on the basis of a normal weight for a gif as a final image ... :shock:
Any tricks? Anything I can do at least to take some weight out?
Thanks!
lleoun

Re: Less weight

Post by lleoun »

Guys, some advance!

This:

$cmd = "convert -deconstruct -delay 300 -loop 0 ".$path."*.jpg ".$path."final.gif";
exec($cmd,$erroer);

halfs the size, now it is 221 KB, almost there!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Less weight

Post by fmw42 »

again, see the gif animation optimations page listed above.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Less weight

Post by anthony »

If it is an animation (not a single image)

You can try -layers Optimize or at least -layers OptimizeTransparency

Other than that using a common color pallete, reduced colors, ordered dithering etc can also help, depending on how related the images are.

For examples of this see Video to GIF
http://www.imagemagick.org/Usage/video/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply