PHP 7.2.0 Release Candidate 4 Released


(PECL imagick 2.0.0)

Imagick::setImageTypeConfigure le type d'image


bool Imagick::setImageType ( int $image_type )

Configure le type d'image.

Liste de paramètres


Valeurs de retour

Retourne TRUE en cas de succès.

add a note add a note

User Contributed Notes 2 notes

lee dot traynor at skeptic dot de
5 years ago
This function can be used to desaturate an image, i.e. to convert a coloured image into a greyscale:


= new Imagick ("image.jpg");
$im->setImageType (2);
//is now in 256 shades of grey

quickshiftin at gmail dot com
3 years ago
The cleaner way to set the type to grayscale is to use the Imagick class constant.

$oBw = new \Imagick($sSourceImage);

I've found this to be a rather harsh 'convert to grayscale' approach. Fred's color2gray script works much better, but it's written in Bash. Time to get it ported over lol
To Top