SetLowlightColor不起作用!
using (IMagickImage img1 = new MagickImage(Path.Combine(fullpath, IMAGE1)))
{
using (IMagickImage img2 = new MagickImage(Path.Combine(fullpath, IMAGE2)))
{
using (IMagickImage imgDiff = new MagickImage())
{
img1.ColorFuzz = new Percentage(fuzz);
imgDiff.SetLowlightColor(new MagickColor(Color.Blue));
double diff = img1.Compare(img2, ErrorMetric.Absolute, imgDiff);
imgDiff.Write(result);
}
}
}
答案 0 :(得分:0)
您似乎在Magick.NET库中发现了一个错误。我刚刚发布了该库的7.1.0.0版来解决您的问题。但我还决定从SetLowlightColor
类移动MagickImage
并引入一个名为CompareSettings
的新类,您可以在其中设置Lowlightcolor
。移动此属性是因为它仅由compare方法使用。您的代码应更改为:
using (IMagickImage img1 = new MagickImage(Path.Combine(fullpath, IMAGE1)))
{
using (IMagickImage img2 = new MagickImage(Path.Combine(fullpath, IMAGE2)))
{
using (IMagickImage imgDiff = new MagickImage())
{
img1.ColorFuzz = new Percentage(fuzz);
CompareSettings settings = new CompareSettings()
{
Metric = ErrorMetric.Absolute,
LowlightColor = MagickColors.Blue
};
double diff = img1.Compare(img2, settings, imgDiff);
imgDiff.Write(result);
}
}
}