I'm trying to implement photoshop-like high-pass filter. One of the steps is subtracting blurred image from it`s original, but composing operation should keep values below zero. In ImageMagick this can be done with "-set option:compose:clamp=off". How can I do this in Magick.NET?
Code: Select all
public MagickImage HighPass(MagickImage src, double radius = 2)
{
MagickImage dst = (MagickImage)src.Clone();
dst.Settings.SetDefine("compose:clamp", "off"); // Has no effect
dst.GaussianBlur(radius, radius * 0.3);
dst.Composite(src, CompositeOperator.MinusDst); // Here we need to keep values below zero
dst.Evaluate(Channels.RGB, EvaluateOperator.Add, 128);
return dst;
}