This project has moved. For the latest updates, please go here.

Setting options to images in Magick .NET collection

Oct 12, 2014 at 3:53 PM
I'm trying to reduce the file sizes of the GIF animations I'm exporting, I've read up on how to do it. Another thread suggested to reduce the quality, add compression and slightly blur the picture which is what I'm trying to do like so:
using (MagickImageCollection col = new MagickImageCollection(@"C:/PathToGif"))
            for (int i = 0; i < col.Count; i++)
                col[i].Quality = 85;
                //col[i] optional blur etc
                col[i].CompressionMethod = CompressionMethod.LZW;

The code runs however the settings seem to be ignored, while setting AnimationDelay the same way does work. I verify it by checking the quality and file size of the output, which seem to be the same as when I don't use any of the settings. Even setting quality to 20, gives the same results.

I've also attempted to use QuantizeSettings where I passed a value of 255 to the colors property. Which just seemed to lock my application up, while using 50% CPU. (I gave it about 5 minutes before forcefully closing the application)

My application processes a .GIF of about 950 kB and turns it into 5.3 mB which is unacceptable.

Could someone tell me if I'm doing something wrong and point me into the right direction of doing this? I was unable to find a different way of applying these settings.
Oct 13, 2014 at 7:08 PM
The GIF coder does not use the Quality setting and the CompressionMethod will always be CompressionMethod.LZW. You should do the following if you want to optimize the output file:
using (MagickImageCollection col = new MagickImageCollection(@"C:/PathToGif"))



Make sure you upgrade to the latest version, the Optimize/OptimizeTransparency methods were bugged in previous versions.