0

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 ?

dlemstra
  • 7,813
  • 2
  • 27
  • 43
user3598321
  • 105
  • 6
  • `ctor` or `cctor` or `field initializer` of `ImageMagick.Types` is throwing the exception. Check inner exception for more info – Sriram Sakthivel May 08 '14 at 05:07
  • You should not use 'MagickNET.Initialize'. It is used for the configuration files, not the xml documentation. Feel free to start a topic here also: https://magick.codeplex.com/discussions – dlemstra May 09 '14 at 07:11
  • BTW friends, I have found the resolution for my problem and I used System.Drawing assembly in .NET to achieving this resolution. SO no need to use Magick.net. – user3598321 May 09 '14 at 08:38

1 Answers1

1

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... ;-)

enter image description here

David
  • 81
  • 1