gray scale image with Magick++ API

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
leon

gray scale image with Magick++ API

Post by leon »

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");
Post Reply