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
?>
Imagick::getImageGeometry
(PECL imagick 2.0.0)
Imagick::getImageGeometry — 幅と高さを連想配列で取得する
説明
array Imagick::getImageGeometry
( void
)
幅と高さを連想配列で返します。
返り値
画像の幅と高さを表す配列を返します。
エラー / 例外
エラー時に ImagickException をスローします。
benkuhl at gmail dot com ¶
6 months ago
tim at provu dot co dot uk ¶
4 years ago
Example code:
<?php
$image = new imagick($filename);
$geo=$image->getImageGeometry();
$sizex=$geo['width'];
$sizey=$geo['height'];
?>
