Using Magick.NET-Q8-AnyCPU. I want to convert existing TIFF image to grayscale 8 bpp BMP image. I tried this:
byte[] input = <existing TIFF image>;
using (var image = new MagickImage(input))
{
image.Grayscale();
image.ColorType = ColorType.Palette;
image.Depth = 8;
image.Quantize(new QuantizeSettings() { Colors = 256, DitherMethod = DitherMethod.No });
byte[] result = image.ToByteArray(MagickFormat.Bmp);
return result;
}
In FastStone Viewer the image is reported as 8-bit, HOWEVER in file Properties > Details the image is reported as Bit depth: 32. I need it to be 8 here. I can convert this image in Paint.NET, and when I choose there Bit Depth: 8-bit then new image will properly show 8-bit depth in file properties.
So, Paint.NET creates proper 8-bit bitmap. How to do it with Magick.NET?