PHP | Imagick setImageType() Function Last Updated : 17 Feb, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The Imagick::setImageType() function is an inbuilt function in PHP which is used to set the image type.Syntax: bool Imagick::setImageType( int $image_type ) Parameters: This function accepts a single parameter $image_type which contains an integer value corresponding to one of IMGTYPE constants. We can also pass the constant directly like setImageType(imagick::IMGTYPE_GRAYSCALE);.All the IMGTYPE constants are listed below: imagick::IMGTYPE_UNDEFINED (0)imagick::IMGTYPE_BILEVEL (1)imagick::IMGTYPE_GRAYSCALE (2)imagick::IMGTYPE_GRAYSCALEMATTE (3)imagick::IMGTYPE_PALETTE (4)imagick::IMGTYPE_PALETTEMATTE (5)imagick::IMGTYPE_TRUECOLOR (6)imagick::IMGTYPE_TRUECOLORMATTE (7)imagick::IMGTYPE_COLORSEPARATION (8)imagick::IMGTYPE_COLORSEPARATIONMATTE (9)imagick::IMGTYPE_OPTIMIZE (10) Return Value: This function returns TRUE on success.Below programs illustrate the Imagick::setImageType() function in PHP:Program 1: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Set the Image Type to imagick::IMGTYPE_GRAYSCALEMATTE $imagick->setImageType(3); // Display the image header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Program 2: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); // Set the Image Type to imagick::IMGTYPE_BILEVEL $imagick->setImageType(1); // Display the image header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagick.setimagetype.php Comment More infoAdvertise with us Next Article PHP | Gmagick setimagetype() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | Gmagick setimagetype() Function The Gmagick::setimagetype() function is an inbuilt function in PHP which is used to set the image type. Syntax: Gmagick Gmagick::setimagetype( int $imgType ) Parameters: This function accepts a single parameter $imgType which holds an integer value corresponding to one of the IMGTYPE constants. All 2 min read PHP | Imagick setImagePage() Function The Imagick::setImagePage() function is an inbuilt function in PHP which is used to set the image page geometry. Syntax: bool Imagick::setImagePage(int $width, int $height, int $x, int $y ) Parameters: This function accepts four parameters as mentioned above and described below: $width: It specifies 1 min read PHP | Imagick setImageExtent() Function The Imagick::setImageExtent() function is an inbuilt function in PHP which is used to set the image size. This function doesn't scales the image but crops the unwanted parts. Syntax: bool Imagick::setImageExtent( int $columns, int $rows ) Parameters: This function accepts two parameters as mentioned 1 min read PHP | Imagick setImageProfile() Function The Imagick::setImageProfile() function is an inbuilt function in PHP which is used to set the named profile to the Imagick object. Syntax: bool Imagick::setImageProfile( string $name, string $profile ) Parameters:This function accepts two parameters as mentioned above and described below: $name: It 1 min read PHP | Imagick setImageScene() Function The Imagick::setImageScene() function is an inbuilt function in PHP which is used to set the image scene. The value of scene contains an integer value. Syntax: bool Imagick::setImageScene( int $scene ) Parameters: This function accepts a single parameter $scene which holds the scene. Return Value: T 1 min read PHP | Imagick setImageDispose() Function The Imagick::setImageDispose() function is an inbuilt function in PHP which is used to sets the image disposal method. Syntax: bool Imagick::setImageDispose( $dispose ) Parameters: This function accepts single parameter $dispose which specifies the dispose Imagick object to be set. Return Value: Thi 2 min read Like