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