PHP 8.5.0 Alpha 4 available for testing

Voting

: two plus two?
(Example: nine)

The Note You're Voting On

Victor
7 years ago
Here's an example of how to interpret and use ImageResolution and ImageUnits:

$i = new Imagick('some_image_file.png');

$r = $i->getImageResolution();
$u = $i->getImageUnits();
if ($u == Imagick::RESOLUTION_PIXELSPERCENTIMETER) {
$r[x] = (int)round($r[x] * 2.54);
$r[y] = (int)round($r[y] * 2.54);
$i->setImageUnits(Imagick::RESOLUTION_PIXELSPERINCH);
$i->setImageResolution($r[x], $r[y]);

//note that the number type is double again
$r = $i->getImageResolution();
}

<< Back to user notes page

To Top