I am trying to convert an image to black and white by changing the color space with this code:
$im = new Imagick('image.png');
$im->setImageColorspace(Imagick::COLORSPACE_GRAY);
$im->writeImage('out.png');
However, after this code, there are no visible image changes (out.png and image.png look indistinguishable). Any thoughts on why this might be? Is this the right method to convert and image to B&W? Are there any other methods?
I also tried setColorspace (Imagick :: COLORSPACE_GRAY); with the same results.
Here is the software that I use:
ImageMagick 6.6.9-7
PHP 5.3.10-1ubuntu3.1
Server version: Apache/2.2.22 (Ubuntu)
Edit: Additional Information
I also tried converting to other color spaces (specifically CMY and CMYK) and did not notice any visual difference.
source
share