以下是如何解释和使用 ImageResolution 和 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]);
// 注意数字类型再次为 double
$r = $i->getImageResolution();
}