Enum AlphaCompare
How Compare(Raster, Raster, CompareOptions?) and Difference(Raster, Raster, DifferenceStyle, DifferenceOptions?) treat alpha.
public enum AlphaCompare
Fields
Premultiplied = 0Colors are multiplied by their alpha before they are compared, so two fully transparent pixels are equal whatever color is stored under them: what a viewer sees. ImageMagick 7's compare works this way too.
Straight = 1The stored channels are compared as they are, so a different color under a transparent pixel counts.
Examples
// Every cheap metric in one pass, per channel and overall, on the 0 to 1 scale; SSIM on request.
CompareResult result = Raster.Compare(expected, actual, new CompareOptions { Ssim = true, Fuzz = 0.02f });
Console.WriteLine($"PSNR {result.Overall.Psnr:F1} dB, SSIM {result.Overall.Ssim:F4}, {result.DifferentPixels} pixels off by more than 2%");
bool sameLook = result.Overall.Psnr >= 40;