downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Imagick::setImageCompose> <Imagick::setImageColormapColor
[edit] Last updated: Fri, 10 Feb 2012

view this page in

Imagick::setImageColorspace

(PECL imagick 2.0.0)

Imagick::setImageColorspaceSets the image colorspace

Description

bool Imagick::setImageColorspace ( int $colorspace )

Sets the image colorspace.

Parameters

colorspace

Return Values

Returns TRUE on success.

Errors/Exceptions

Throws ImagickException on error.



Imagick::setImageCompose> <Imagick::setImageColormapColor
[edit] Last updated: Fri, 10 Feb 2012
 
add a note add a note User Contributed Notes Imagick::setImageColorspace
mettedraq at gmail dot com 01-Jul-2010 12:21
This is how to Monochrome a jpg [on Windows].. since I couldn't find it anywhere else.

<?php
header
("Content-type: image/jpeg");

$IMagick = new IMagick('c:\\testing\\fruit.jpg');
$IMagick->setImageColorSpace(Imagick::COLORSPACE_GRAY);

echo
$IMagick;
?>
charlie at midsouthhost dot com 06-May-2010 09:45
If your getting strange/bad color rendering from a PDF, after trying the colorspace constants noted by jdstraughan, try other values outside that range.

In one case for me only $image->setImageColorSpace(22) provided useful color. I have found posts elsewhere using values up to 255.
jdstraughan dot com at gmail dot com 26-Sep-2008 12:16
FYI, here is the breakdown for (int $colorspace):

Constants:
0 - UndefinedColorspace   
1 - RGBColorspace   
2 - GRAYColorspace   
3 - TransparentColorspace   
4 - OHTAColorspace   
5 - LABColorspace   
6 - XYZColorspace   
7 - YCbCrColorspace   
8 - YCCColorspace   
9 - YIQColorspace   
10 - YPbPrColorspace   
11 - YUVColorspace   
12 - CMYKColorspace   
13 - sRGBColorspace   
14 - HSBColorspace   
15 - HSLColorspace   
16 - HWBColorspace

 
show source | credits | sitemap | contact | advertising | mirror sites