howto reduce filesize of an animated gif

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
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Post by glennrp »

Do you happen to have, or can you get, the original images, before they were converted to JPEG? Converting a raw image to jpeg and then
to GIF usually results in increased file size.

Perhaps you can reduce the GIF size by quantizing down to a small number of colors.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Especially to a smaller number of common colors.

Also how different are the images? Completely different?

Currently in development and in the latest beta (6.2.9-8) is a revised version of ordered dither, that will not only dither to two channel levels, but to a specified set of channel levels.

That means if you like a common colormap for very different images, and no transparency you can use somehing like

Code: Select all

  convert  images... -ordered-dither o8x8,8,8,4  -loop 0 slideshow.gif
This will dither your images to a standard 256 color '332' . You can also use

Code: Select all

  convert  images... -ordered-dither o8x8,6  -loop 0 slideshow.gif
to use a level 6 posterized 'web-safe' colormap.

This new ordered dither expasion is finalised but undocumented. I am now reasearching XML to allow IM to read ordered dither threshold maps from pre-defined "threshold.xml" files (system and user defined) rather than limiting it to just built-in hardcoded maps.

ASIDE: the -page +0+0 is the default as JPEG has no understanding of virtual canvases. You can also reset all images to that setting using +repage afetr reading them all in.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Post by glennrp »

kswtch wrote: thank you for your replies.
first i tried to do what glennrp suggested and tried to get the images in raw format. i didn't get the exact images but similar ones in pcx format and it worked great. but they weren't the images I want ;)

all images are similar in color (at least in raw format). I'm still trying to get some usable results with -ordered-dither. it reduces the file size dramatically but with the cost of almost any color ;)

I let you know if I get any further.


Try the
  • -map map.bmp
option. For map.bmp you could use any representative file from the sequence, or, to be sure you get all of the original colors, do
  • convert +append *.bmp map.bmp
and then use that.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

If the -ordered-dither o8x8,6 only produced 8 colors your version is a little too old.
The level functions were only completed during the last week, and was not in 6.2.9-7
where level info is ignored. you must have the latest 6.2.9-8 for the level parts to work.

As mentioned I haven't even fully documented it yet, only the latest 'development notes' document shows what you should get.
http://www.cit.gu.edu.au/~anthony/graph ... ed-dither/

This is really bleeding edge!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply