PHP | Gmagick getimagedepth() Function
Last Updated :
28 Aug, 2019
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 Gmagick::getimagedepth() function in PHP:
Original Image 1:
Program 1:
<?php
$image = new Gmagick(
$height = $image ->getimagedepth();
print_r( $height );
?>
|
Output:
8
Original Image 2:
Program 2:
<?php
$string = "Computer Science portal for Geeks!" ;
$im = new Gmagick();
$draw = new GmagickDraw();
$draw ->setFillColor( new GmagickPixel( 'green' ));
$draw ->setFontSize(50);
$metrix = $im ->queryFontMetrics( $draw , $string );
$draw ->annotation(0, 40, $string );
$im ->newImage( $metrix [ 'textWidth' ], $metrix [ 'textHeight' ],
new GmagickPixel( 'white' ));
$im ->drawImage( $draw );
$im ->setImageFormat( 'jpeg' );
$dpth = $im ->getimagedepth();
print_r( $dpth );
?>
|
Output:
8
Reference: http://php.net/manual/en/gmagick.getimagedepth.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...