PHP | Gmagick getimagechanneldepth() Function Last Updated : 06 Oct, 2021 Comments Improve Suggest changes Like Article Like Report 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 valid for channel mode. The default value of channel is Gmagick::CHANNEL_DEFAULT.Return Value: This function returns the depth of channel.Below programs illustrate the Gmagick::getimagechanneldepth() function in PHP:Original Image 1: Program 1: php <?php // Create new Gmagick object $im = new Gmagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-15.png'); // Using getimagechanneldepth function // with different channel echo $im->getimagechanneldepth(Gmagick::CHANNEL_RED) . "</br>"; echo $im->getimagechanneldepth(Gmagick::CHANNEL_GRAY) . "</br>"; echo $im->getimagechanneldepth(Gmagick::CHANNEL_CYAN) . "</br>"; echo $im->getimagechanneldepth(Gmagick::CHANNEL_GREEN) . "</br>"; echo $im->getimagechanneldepth(Gmagick::CHANNEL_BLUE) . "</br>"; ?> Output: 8 8 8 8 8 Original Image 2: Program 2: php <?php $string = "Computer Science portal for Geeks!"; // Creating new image of above String // and add color $im = new Gmagick(); $draw = new GmagickDraw(); // Fill the color in image $draw->setFillColor(new GmagickPixel('green')); // Set the text font size $draw->setFontSize(50); $matrix = $im->queryFontMetrics($draw, $string); $draw->annotation(0, 40, $string); $im->newImage($matrix['textWidth'], $matrix['textHeight'], new GmagickPixel('white')); // Draw the image $im->drawImage($draw); $im->setImageFormat('jpeg'); // Using getImageChannelDepth function // with different channel echo $im->getimagechanneldepth(Gmagick::CHANNEL_RED) . "</br>"; echo $im->getimagechanneldepth(Gmagick::CHANNEL_GRAY) . "</br>"; echo $im->getimagechanneldepth(Gmagick::CHANNEL_CYAN) . "</br>"; echo $im->getimagechanneldepth(Gmagick::CHANNEL_GREEN) . "</br>"; echo $im->getimagechanneldepth(Gmagick::CHANNEL_BLUE) . "</br>"; ?> Output: 8 8 8 16 8 Reference: http://php.net/manual/en/gmagick.getimagechanneldepth.php Comment More infoAdvertise with us Next Article PHP | Gmagick getimagechanneldepth() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP Image-Processing PHP-function PHP-Gmagick +1 More Similar Reads 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 | Gmagick getimagedepth() Function The Gmagick::getimagedepth() function is an inbuilt function in PHP which is used to gets the depth of the image. Syntax: int Gmagick::getimagedepth( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns the depth of image. Below programs illustrate the 1 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 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 PHP | Imagick getImageChannelExtrema() Function The Imagick::getImageChannelExtrema() function is an inbuilt function in PHP which is used to get the extrema for one or more image channels. Extrema are the points at which a maximum or minimum value of a function is observed. It returns an associative array with the keys "minima" and "maxima". Syn 1 min read Like