fapw
fapw

Reputation: 195

Compare images with metric PSNR in ImageMagick using Java API (JMagick) or C# API (Magick.Net)

Could you help me to implement image comparison with metric PSNR in ImageMagick using Java API (JMagick) or C# API (Magick.Net).

The command is:

convert image1.jpg -resize WidthxHeight image2.jpg -metric PSNR -format "%[distortion]" -compare info:

I've tried to find something in documentation about JMagick here: http://www.jmagick.org/jmagick-doc/ and about Magick.NET here: http://magick.codeplex.com/documentation without result.

Thanks for your help.

Upvotes: 0

Views: 912

Answers (1)

dlemstra
dlemstra

Reputation: 8153

I am the author of the Magick.NET API so I can only help you with the Magick.NET part.

Magick.NET

using (MagickImage image1 = new MagickImage("image1.jpg"))
{
  using (MagickImage image2 = new MagickImage("image2.jpg"))
  {
    double distortion = image1.Compare(image2, ErrorMetric.PeakSignalToNoiseRatio);
  }
}

Feel free to edit my answer and add an example for JMagick.

Upvotes: 2

Related Questions