PHP 8.0.0 Beta 4 available for testing


(No version information available, might only be in Git)

Imagick::setColorspaceEstablecer el espacio de color


Imagick::setColorspace ( int $COLORSPACE ) : bool

Establece el valor del espacio de color global para el objeto. Este método está disponible si Imagick ha sido compilado con la versión 6.5.7 o superior de ImageMagick.



Una de las constantes COLORSPACE

Valores devueltos

Devuelve TRUE en caso de éxito.


Lanza ImagickException en caso de error.

add a note add a note

User Contributed Notes 2 notes

simonjjarrett at gmail dot com
5 months ago
This method has to be called BEFORE any files are loaded into the Imagick object.

By default, Imagick will incorrectly read CMYK PDFs - it will read each channel as a greyscale page resulting in 4 times the number of pages. By specifying the desired colorspace (usually SRGB) before reading the file, GhostScript will automatically convert it.

= new Imagick();

// set the sampling resolution

// set the desired format

5 years ago
Right now this function doesn't appear to do anything, ref:

As mentioned in the answer, modulateImage works fine as a replacement for converting to gray scale.


= new Imagick("input.jpg");

$image->modulateImage(100, 0, 100);



To Top