Page 1 of 1

Does BilevelType or monochrome work?

Posted: 2007-01-16T14:08:00-07:00
by xinito
Hi,

I tried to convert an image to grayscale using C++API. For instance, the original image aaa.bmp is grayscale.

image.segment(size,1.5);
image.type(Magick::BilevelType);

I expect this will give me a binary image, but instead, it generated a pure black image. I also tried to use image.monochrome(); but it didn't work either.

Please advise.

Thanks.

Posted: 2007-01-16T14:15:03-07:00
by xinito
sorry, i mean to convert the original greyscale image to a binary image.

Re:

Posted: 2007-07-03T02:42:34-07:00
by aless
xinito wrote:sorry, i mean to convert the original greyscale image to a binary image.
You don't want to simply change its color type - you want to binarize it. check out Image.threshold() and Image.adaptiveThreshold(), and eventually switch to BilevelType after applying the threshold - Image.write will then produce smaller files.