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:
var image1Path = @"D:\Compare Test\image1.jpg";
var image2Path = @"D:\Compare Test\image2.jpg";
var diffImagePath = @"D:\Compare Test\imageDiff.jpg";
using (MagickImage image1 = new MagickImage(image1Path))
using (MagickImage image2 = new MagickImage(image2Path))
using (MagickImage 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.
Reference the "Illustrated Examples" in the answer to the following SO question: Diff an Image What I'm getting is the first example. What I want is the last example.
Any help would be greatly appreciated.