This project has moved and is read-only. For the latest updates, please go here.

Layers OptimizeTransparency effect?

Jul 22, 2014 at 9:46 PM
I'd like to know how to optimize my generated gif files based on layer transparency. This is super important because it can, in one line, roughly halve the size of most gif files at zero loss.

If possible, I'd also like to know how to adjust fuzz factor as this can further decrease gif size at small losses.

And while we're at it, global colour maps.

http://www.imagemagick.org/Usage/anim_opt/#opt_trans
http://www.imagemagick.org/Usage/color_basics/#fuzz
http://www.imagemagick.org/script/command-line-options.php?#map

So for example the line...

convert input.gif -fuzz 5% -layers OptimizeTransparency +map output.gif
Jul 23, 2014 at 10:25 PM
This is not possible with the current release of Magick.NET. This is the code that you can use in the next release of Magick.NET:
using (MagickImageCollection images = new MagickImageCollection("bunny_bgnd.gif"))
{
  foreach (MagickImage image in images)
  {
    image.ColorFuzz = 5;
  }

  images.OptimizeTransparency();
  images.Map();

  images.Write("bunny_bgnd.new.gif"))
}