I am trying to remove the green background of this image using Magick.Net but I'm kind of stuck.
I have tried the following:
var image = new MagickImage("test.jpg");
image.ColorFuzz = new Percentage(20);
image.TransparentChroma(new MagickColor("#0F562A"), new MagickColor("#43B788"));
image.Write("test_result.jpg");
But I don't see any differences between test.jpg
and test_result.jpg
. The colors that I have chosen for low and high may not be the best choices but my strategy has been to choose a "light green" and a "dark green" from the image with a color picker (lacking the knowledge of what else to do).
I can't find any useful examples of how to use the TransparentChroma
method so I might be on a wrong track here.
The TransparentChroma method makes all the pixels between the low and high color transparent. But your output image is a JPEG that does not have an alpha channel. You will have to save your image as a PNG or another format that supports transparency to see the correct image.
You will also have to play a bit more with the low and high value because this is the output image: