I'm using Magick.NET (Q16-x64 v7.0.0.0011) to compare images. When I use the command line version of ImageMagick and do a compare without any special options, it gives an image with the identical portions shown as a lightened background and the differences in red. I'm trying to duplicate this behavior in Magick.NET. I tried the following code:
Code: Select all
var image1Path = @"D:\CompareTest\image1.png";
var image2Path = @"D:\CompareTest\image2.png";
var diffImagePath = @"D:\CompareTest\imageDIFF.png";
using (MagickImage image1 = new MagickImage(image1Path))
using (MagickImage image2 = new MagickImage(image2Path))
{
var diffImage = new MagickImage();
image1.Compare(image2, ErrorMetric.Absolute, diffImage);
diffImage.Write(diffImagePath);
}
What I end up with though is a file that shows only the differences. This seems like what you would get if you ran the command line version with "-compose src". The differences are whatever SetHighlightColor is set to and the rest of the image is a solid color according to SetLowlightColor. I tried several different files and file formats with the same result.
Maybe the answer is that I need to assemble that final image myself by combining the originals and the diff. I'm not having much luck with that either. Any help would be greatly appreciated.
-Craig