PHP | Imagick getImageType() Function Last Updated : 22 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The Imagick::getImageType() function is an inbuilt function in PHP which is used to get the potential image type. Syntax: int Imagick::getImageType( void ) Parameters: This function doesn’t accepts any parameter. Return Value: This function returns an integer value corresponding to one of IMGTYPE constants. 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) Exceptions: This function throws ImagickException on error. Below given programs illustrate the Imagick::getImageType() 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'); // Get the Image Type $type = $imagick->getImageType(); echo $type; ?> Output: 7 // Which corresponds to imagick::IMGTYPE_TRUECOLORMATTE. 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 $imagick->setImageType(3); // Get the Image Type $type = $imagick->getImageType(); echo $type; ?> Output: 3 // Which corresponds to imagick::IMGTYPE_GRAYSCALEMATTE. Reference: https://www.php.net/manual/en/imagick.getimagetype.php Comment More infoAdvertise with us Next Article PHP | Imagick getImageType() Function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | Gmagick getimagetype() Function The Gmagick::getimagetype() function is an inbuilt function in PHP which is used to get the image type. Syntax: int Gmagick::getimagetype( void ) Parameters: This function doesnât accept any parameters. Return Value: This function returns an integer value corresponding to one of the IMGTYPE constant 1 min read PHP | Imagick getImageMimeType() Function The Imagick::getImageMimeType() function is an inbuilt function in PHP which is used to get MIME type of an imagick object. Syntax: bool Imagick::getImageMimeType( void ) Parameters: This function does not accept any parameter. Return Value: This function returns True on success. Below programs illu 1 min read PHP | Imagick getImagePage() Function The Imagick::getImagePage() function is an inbuilt function in PHP which is used to get the page geometry of a particular image. Syntax: array Imagick::getImagePage( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns an array associated with the page 2 min read PHP | Imagick getImageMatte() Function The Imagick::getImageMatte() function is an inbuilt function in PHP which is used to get the matte channel of an imagick object.Syntax:  bool Imagick::getImageMatte( void ) Parameters: This function does not accept any parameter.Return Value: This function returns True if image has a matte channel 1 min read PHP | Imagick getImageSize() Function The Imagick::getImageSize() function is an inbuilt function in PHP which is used to get the image length in bytes. Syntax: int Imagick::getImageSize( void ) Parameters: This function doesnât accepts any parameter. Return Value: This function returns an integer value containing the current image size 1 min read Like