PHP | Imagick getImageGeometry() Function Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share 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: https://www.php.net/manual/en/imagick.getimagegeometry.php Comment More infoAdvertise with us Next Article PHP | Imagick getImageType() 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 Like