简体   繁体   中英

The type initializer for 'ImageMagick.Types' threw an exception

I have just installed a Magick.net from the nuget and codeplex. I just want to write a sample application for compressing an image file by reducing its quality and DPI.

As per the little documentation which is available at codeplex, I written the below snippet.

MagickNET.Initialize(@"<<myPath>>\Magick.NET-x86.xml");

 using (MagickImage mImage = new MagickImage(txtSourceImage.Text.Trim()))
                    {
                        mImage.Quality = 33;
                        mImage.Depth = 8;
                        mImage.Density = new MagickGeometry(850, 550);
                        mImage.Write(tempFilePath);
}

it gives me an error, "The type initializer for 'ImageMagick.Types' threw an exception"
Please any one help me. What is wrong here ?

to: 'user3598321': About using the System.Drawing... - Have you seen the small note at the bottom of page https://msdn.microsoft.com/en-us/library/system.drawing.aspx ? You should move back to MagickNET again... ;-)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM