gray scale image with Magick++ API

Li Lirong <[email protected]>
Newsgroups gmane.comp.video.image-magick.user
Message-ID <[email protected]>
Hi,

I tried to convert color images to gray images with the following code:

Magick::Image image;
image.read("color.jpg");
image.colorSpace(GRAYColorspace);
image.write("gray.jpg");

The resulted image seems to be exactly as the original image. What's
wrong with my code?

Thank you for your help in advance.

I also tried this without success:
Magick::Image image;
image.read("color.jpg");
image.monochrome(true);
image.write("gray.jpg");

Best regards!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.