(PECL imagick 2.0.0)
Imagick::getImageGeometry — Gets the width and height as an associative array
Returns the width and height as an associative array.
Returns an array with the width/height of the image.
错误时抛出 ImagickException。
benkuhl at gmail dot com (2012-11-29 16:48:09)
Because this method returns points, you can easily convert to a decimal representation of inches by dividing by 72.
<?php
$image = new imagick($filename);
$geo = $image->getImageGeometry();
$sizex = $geo['width']; //1089
$sizey = $geo['height']; //396
echo round($sizex / 72, 2); //15.13 inches
echo round($sizey / 72, 2); //5.5 inches
?>
tim at provu dot co dot uk (2008-11-20 07:05:09)
Example code:
<?php
$image = new imagick($filename);
$geo=$image->getImageGeometry();
$sizex=$geo['width'];
$sizey=$geo['height'];
?>