Just to be clear do you want a black and white image or a grayscale image? For me a black and white image only contains two colors (black and white). You should only use bilevel if that is your goal. But I think you want a grayscale image.
One trick would be adjusting the gamma of the image:
But I think you are looking for the ColorMatrix method:
One trick would be adjusting the gamma of the image:
using (MagickImage image = new MagickImage("input.jpg")) { image.ColorType = ColorType.Grayscale; image.Gamma(2.0); image.Write("output.jpg"); }
using (MagickImage image = new MagickImage("input.jpg")) { ColorMatrix matrix = new ColorMatrix(3); // SetRow won't be available until the next release.// Use SetValue(x,y) for now (I feel your pain...) matrix.SetRow(0, 0.2, 0.5, 0.3); matrix.SetRow(1, 0.2, 0.5, 0.3); matrix.SetRow(2, 0.2, 0.5, 0.3); image.ColorMatrix(matrix); image.Write("output.jpg"); }