Does BilevelType or monochrome work?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
xinito

Does BilevelType or monochrome work?

Post 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.
xinito

Post by xinito »

sorry, i mean to convert the original greyscale image to a binary image.
aless

Re:

Post 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.
Post Reply