PHP | Imagick getImageGeometry() Function Last Updated : 10 Jan, 2022 Comments Improve Suggest changes Like Article Like Report The Imagick::getImageGeometry() function is an inbuilt function in PHP which is used to get the width and height as an associative array. Syntax: array Imagick::getImageGeometry( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns the width and height as an associative array. Errors/Exceptions: This function Throws ImagickException on error. Below program illustrates the Imagick::getImageGeometry() function in PHP: Program 1: Original Image: php <?php // require_once('path/vendor/autoload.php'); // Create an Imagick Object $image = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-15.png'); // Use getImageHeight function to // calculate image height $res= $image->getImageGeometry(); // Display the width and height of image print_r($res); ?> Output: Array ( [width] => 667 [height] => 184 ) 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); $matrix = $im->queryFontMetrics($draw, $string); $draw->annotation(0, 40, $string); $im->newImage($matrix['textWidth'], $matrix['textHeight'], new ImagickPixel('white')); // Draw the image $im->drawImage($draw); $im->setImageFormat('jpeg'); $res= $im->getImageGeometry(); // Display the width and height of image print_r($res); ?> Output: Array ( [width] => 798 [height] => 62 ) Reference: http://php.net/manual/en/imagick.getimagegeometry.php Comment More infoAdvertise with us Next Article PHP | Imagick getImageGeometry() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP Image-Processing PHP-function PHP-Imagick +1 More Similar Reads PHP | Imagick getImageMimeType() Function The Imagick::getImageMimeType() function is an inbuilt function in PHP which is used to get MIME type of an imagick object. Syntax: bool Imagick::getImageMimeType( void ) Parameters: This function does not accept any parameter. Return Value: This function returns True on success. Below programs illu 1 min read PHP | Imagick getImagePage() Function The Imagick::getImagePage() function is an inbuilt function in PHP which is used to get the page geometry of a particular image. Syntax: array Imagick::getImagePage( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns an array associated with the page 2 min read PHP | Imagick getImageProperty() Function The Imagick::getImageProperty() function is an inbuilt function in PHP which is used to get the image property. The main difference between image properties and image artifacts is that the properties are public whereas artifacts are private. Syntax: string Imagick::getImageProperty( string $name ) P 1 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 PHP | Imagick getImageFormat() Function The Imagick::getImageFormat() function is an inbuilt function in PHP which is used to get the format of a particular image in a sequence Syntax:  string Imagick::getImageFormat( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns a string of the imag 1 min read PHP | Imagick getImageCompose() Function The Imagick::getImageCompose() function is an inbuilt function in PHP which is used to get the composite operator associated with the image. Syntax: int Imagick::getImageCompose( void ) Parameters: This function does not accept any parameter. Return Value: This function returns TRUE on success. Belo 1 min read PHP | Imagick getImageExtrema() Function The Imagick::getImageExtrema() function is an inbuilt function in PHP which is used to get the extrema for an image. Extrema are the points at which a maximum or minimum value of a function is observed. Syntax: array Imagick::getImageExtrema( void ) Parameters: This function doesn't accept any param 1 min read PHP | Imagick getImageGravity() Function The Imagick::getImageGravity() function is an inbuilt function in PHP which is used to get the image gravity. Difference between getGravity() and getImageGravity() is that the former applies for the whole Imagick object whereas the latter gets the gravity of the current image (in case of multiple im 1 min read PHP | Imagick getImageScene() Function The Imagick::getImageScene() function is an inbuilt function in PHP which is used to get the image scene of an Imagick object. Syntax: int Imagick::getImageScene( void ) Parameters: This function does not accept any parameter. Return Value: This function returns the image scene. Below programs illus 1 min read PHP | Imagick getImageRedPrimary() Function The Imagick::getImageRedPrimary() function is an inbuilt function in PHP which returns the chromaticity red primary point. This functions returns an array with keys "x" and "y". Syntax: array Imagick::getImageRedPrimary( void ) Parameters: This function does not accept any parameter. Return Value: T 1 min read Like