I'm using Magick.net version 184.108.40.206.
I'm trying to save to bitmap with bit depth 1, but no matter what I do the bmp still is saved with bit depth 32.
The MagickImage I save is a mosaic of a white background image, some text (drawables) and a barcode.
I've tried different things like:
.Threshold(50), bmpImage.IsMonochrome = true, bmpImage..BitDepth(1), bmpImage.Depth = 1
Some of these seem to compress the image, but the bit depth is still 32.
I'm really no guru with images, but I'm starting to wonder if this is at all doable.
Any help would be appreciated.
Jan 28, 2015 at 3:46 PM
Edited Jan 28, 2015 at 3:46 PM
The IsMonochrome is only used when an image is read by some of the image decoders. This will be moved to MagickReadSettings in the next release.
The BMP encoder will only write a 1 bit image if contains 2 colors and has a color palette. Below is an example that can help you accomplish this.
using (MagickImage image = new MagickImage("logo:"))
// First reduce the colors
image.ColorType = ColorType.Bilevel;
// Or use Quantize
Colors = 2
// Tell image to use a color map
image.ClassType = ClassType.Pseudo;
// HACK! For now you will have to add the code below, this will be fixed in the next release
// Write 1 bit bmp