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

LOSSLES IMAGE COMPRESSION

Feb 10, 2016 at 11:12 AM
Hi, I have problem with ImageOptimizer. I'm doing almost the same process here but I get this error:

An unhandled exception of type 'System.TypeInitializationException' occurred in Magick.NET-Q8-x86.dll


Additional information: The type initializer for 'ImageMagick.MagickFormatInfo' threw an exception.

Any help would be appreciated Thanks.!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Drawing;

namespace LosslesImageCompression
{
   static  class Program
    {
        static void Main(string[] args)
        {
            FileInfo birds = new FileInfo("C:\\dev\\workspaces\\visual studio\\Staj 2016\\HSV\\image\\birds.jpg");  

            ImageMagick.ImageOptimizer optimizer = new ImageMagick.ImageOptimizer();
            Console.WriteLine("Bytes before: "+birds.Length);
            optimizer.LosslessCompress(birds);

            birds.Refresh();
            Console.WriteLine("Bytes after: " + birds.Length);
            
         

        }
    }
}
Coordinator
Feb 10, 2016 at 11:28 AM
Are you using the latest version of Magick.NET? I am guessing that you are using the AnyCPU build? Can you post the exception that is being raised?