This project has moved. For the latest updates, please go here.

Photoshop high pass filter

Jun 8, 2016 at 6:16 PM
Hi,

I try to rebuild a Photoshop high pass filter using ImageMagick convolve.

From the ImageMagick documentation, I got the following:
convert face.png -bias 50% -morphology Convolve DoG:0,0,2 face_dog_unity.png

I tried the following in magick.net:
image.Morphology(MorphologyMethod.Convolve, Kernel.DoG, "0,0,2");

What is missing is the -bias. How can I achieve the filter?

Thanks for your help
Lemon
Coordinator
Jun 9, 2016 at 5:40 AM
Edited Jun 9, 2016 at 5:41 AM
You will need to set the artifact 'convolve:bias'. That is what is being done on the command line.
image.SetArtifact("convolve:bias", "50%");
I should probably also make this available in code a bit easier. I think that adding a new MorphologySettings class for this would be the next wise step instead of adding two new argument to the method (there is also an option called 'convolve:scale').
Coordinator
Jun 10, 2016 at 8:35 AM
Edited Jun 10, 2016 at 8:35 AM
The new class has been added and will be available in the next release: https://magick.codeplex.com/SourceControl/changeset/b0d6cb45c73b34a6959b6ab308e3a1f5998d1d28
Jul 26, 2016 at 4:44 AM
After updating to your latest version, I tried both,
image.SetArtifact("convolve:bias", "50%");
and the new MorphologySettings
var settings = new MorphologySettings();
settings.Kernel = Kernel.DoG;
settings.KernelArguments = "0,0,2";
settings.ConvolveBias = new Percentage(50);
image.Morphology(settings);
Unfortunately, for both examples, I only get a white image as a result which differs from the command line call.

Do you have any idea?

Thanks again
Lemon
Coordinator
Jul 26, 2016 at 7:50 PM
Can you share your input image so I can try to reproduce your issue? Please use something like DropBox or OneDrive to share it.
Jul 26, 2016 at 8:17 PM
Hi,

I tried several input images, including this one:
https://www.dropbox.com/s/uj5w8sscn76rj1i/testimage.jpg?dl=0.
All images result in a white output image.

Kind regards
Lemon
Coordinator
Jul 29, 2016 at 8:46 AM
You will also need to set the method in the settings class. I did not include that in my example:
settings.Method = MorphologyMethod.Convolve;