PHP | Imagick getImageDepth() Function Last Updated : 26 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The Imagick::getImageDepth() function is an inbuilt function in PHP which is used to gets the depth of the image. Syntax: int Imagick::getImageDepth( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns the image depth. Below programs illustrate the Imagick::getImageDepth() function in PHP: Program 1: Original Image: php <?php // require_once('vendor/autoload.php'); // Create an Imagick Object $image = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-15.png'); // Use getImageDepth function to calculate image depth $height = $image->getImageDepth(); // Display the depth of image print_r($height); ?> Output: 8 Program 2: php <?php $string = "Computer Science portal for Geeks!"; // creating new image of above String // and add color and background $im = new Imagick(); $draw = new ImagickDraw(); // Fill the color in image $draw->setFillColor(new ImagickPixel('green')); // Set the text font size $draw->setFontSize(50); $metrix = $im->queryFontMetrics($draw, $string); $draw->annotation(0, 40, $string); $im->newImage($metrix['textWidth'], $metrix['textHeight'], new ImagickPixel('white')); // Draw the image $im->drawImage($draw); $im->setImageFormat('jpeg'); $dpth = $im->getImageDepth(); // Display the depth of image print_r($dpth); ?> Output: 8 Reference: http://php.net/manual/en/imagick.getimagedepth.php Comment More infoAdvertise with us Next Article PHP | Imagick getImageDepth() Function R R_Raj Follow Improve Article Tags : PHP Image-Processing PHP-function PHP-Imagick Similar Reads PHP | Imagick getImageWidth() Function The Imagick::getImageWidth() function is an inbuilt function in PHP which is used to get the width of the image. Syntax: int Imagick::getImageWidth( void ) Parameters: This function does not accepts any parameters. Return Value: This function returns the image width in pixels. Original Image Below p 1 min read PHP | Imagick getImageLength() Function The Imagick::getImageLength() function is an inbuilt function in PHP which is used to get the length of an image object in bytes. Syntax: bool Imagick::getImageLength( void) Parameters: This function does not accept any parameter. Return Value: This function returns the image length in bytes. Below 1 min read PHP | Imagick getImageIndex() Function The Imagick::getImageIndex() function is an inbuilt function in PHP which is used to get the index of the current image. Syntax: int Imagick::getImageIndex( void ) Parameters: This function does not accept any parameter. Return Value: This function returns an integer value containing the index of th 1 min read PHP | Imagick getImageChannelDepth() Function The Imagick::getImageChannelDepth() function is an inbuilt function in PHP which is used to get the depth for channel image. Syntax: int Imagick::getImageChannelDepth( $channel ) Parameters: This function accepts a single parameter $channel which specifies the channel constant that is valid for chan 2 min read PHP | Imagick getImageType() Function 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 co 1 min read Like