PHP | Imagick getImageChannelDepth() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 channel mode. The default value of channel is Imagick::CHANNEL_DEFAULT. Return Value: This function returns True on success. Below programs illustrate the Imagick::getImageChannelDepth() function in PHP: Program 1: Original Image: php <?php // Create new imagick object $im = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-15.png'); // Using getImageChannelDepth function // with different channel echo $im->getImageChannelDepth(imagick::CHANNEL_RED) . "</br>"; echo $im->getImageChannelDepth(imagick::CHANNEL_GRAY) . "</br>"; echo $im->getImageChannelDepth(imagick::CHANNEL_CYAN) . "</br>"; echo $im->getImageChannelDepth(imagick::CHANNEL_GREEN) . "</br>"; echo $im->getImageChannelDepth(imagick::CHANNEL_BLUE) . "</br>"; ?> Output: 8 8 8 8 8 Program 2: Original Image: php <?php $string = "Computer Science portal for Geeks!"; // Creating new image of above String // and add color $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'); // Using getImageChannelDepth function // with different channel echo $im->getImageChannelDepth(imagick::CHANNEL_RED) . "</br>"; echo $im->getImageChannelDepth(imagick::CHANNEL_GRAY) . "</br>"; echo $im->getImageChannelDepth(imagick::CHANNEL_CYAN) . "</br>"; echo $im->getImageChannelDepth(imagick::CHANNEL_GREEN) . "</br>"; echo $im->getImageChannelDepth(imagick::CHANNEL_BLUE) . "</br>"; ?> Output: 8 8 8 16 8 Reference: https://www.php.net/manual/en/imagick.getimagechanneldepth.php Comment More infoAdvertise with us Next Article PHP | Imagick getImageDepth() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP Image-Processing PHP-function PHP-Imagick +1 More Similar Reads PHP | Gmagick getimagechanneldepth() Function The Gmagick::getimagechanneldepth() function is an inbuilt function in PHP which is used to return the depth for channel image.Syntax:Â Â int Gmagick::getimagechanneldepth( $channel_type ) Parameters: This function accepts a single parameter $channel_type which holds the channel constant that is vali 2 min read PHP | Gmagick getimagechanneldepth() Function The Gmagick::getimagechanneldepth() function is an inbuilt function in PHP which is used to return the depth for channel image.Syntax:Â Â int Gmagick::getimagechanneldepth( $channel_type ) Parameters: This function accepts a single parameter $channel_type which holds the channel constant that is vali 2 min read PHP | Imagick getImageChannelMean() Function The Imagick::getImageChannelMean() function is an inbuilt function in PHP which is used to get the mean and standard deviation of one or more image channels. It returns an associative array containing the keys as "mean" and value as "standardDeviation". Syntax: array Imagick::getImageChannelMean(int 1 min read PHP | Imagick getImageDepth() Function 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 Im 1 min read PHP | Imagick getImageDepth() Function 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 Im 1 min read PHP | Imagick getImageChannelRange() Function The Imagick::getImageChannelRange() function is an inbuilt function in PHP which is used to gets the range of channel. Syntax: array Imagick ::getImageChannelRange( $channel ) Parameters: This function accept single parameter $channel which specifies the channel to find image channel range. The defa 2 min read Like