note 114440 added to imagick.getimageresolution
| From: | christianatcvjdotse | Date: | Thu, 20 Feb 2014 23:48:20 +0000 |
| Subject: | note 114440 added to imagick.getimageresolution | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198576@lists.php.net to get a copy of this message | ||
For me getImageResolution() always returns X and Y resolution in pixels per centimeter, no matter if
I set it with setImageUnits() or not.
So an easy way to convert the result from pixels per centimeter to pixels per inch is to do this:
<?php
$resource = new Imagick($path);
$imageResolution = $resource->getImageResolution();
if (!empty($imageResolution['y'])) {
$imageResolution['y'] =
round($imageResolution['y'] * 2.54, 2);
}
if (!empty($imageResolution['x'])) {
$imageResolution['x'] =
round($imageResolution['x'] * 2.54, 2);
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/imagick.getimageresolution.php
Edit -- https://master.php.net/note/edit/114440
Del: integrated -- https://master.php.net/note/delete/114440/integrated
Del: useless -- https://master.php.net/note/delete/114440/useless
Del: bad code -- https://master.php.net/note/delete/114440/bad+code
Del: spam -- https://master.php.net/note/delete/114440/spam
Del: non-english -- https://master.php.net/note/delete/114440/non-english
Del: in docs -- https://master.php.net/note/delete/114440/in+docs
Del: other reasons-- https://master.php.net/note/delete/114440
Reject -- https://master.php.net/note/reject/114440
Search -- https://master.php.net/manage/user-notes.php