array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'imagick.setimageresolution.php', 1 => 'Imagick::setImageResolution', 2 => 'Sets the image resolution', ), 'up' => array ( 0 => 'class.imagick.php', 1 => 'Imagick', ), 'prev' => array ( 0 => 'imagick.setimagerenderingintent.php', 1 => 'Imagick::setImageRenderingIntent', ), 'next' => array ( 0 => 'imagick.setimagescene.php', 1 => 'Imagick::setImageScene', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/imagick/imagick/setimageresolution.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Imagick::setImageResolution

(PECL imagick 2, PECL imagick 3)

Imagick::setImageResolutionSets the image resolution

说明

public Imagick::setImageResolution(float $x_resolution, float $y_resolution): bool

Sets the image resolution.

参数

x_resolution

y_resolution

返回值

成功时返回 true

错误/异常

错误时抛出 ImagickException。

示例

示例 #1 Imagick::setImageResolution()

<?php
function setImageResolution($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->setImageResolution(50, 50);

header("Content-Type: image/jpg");
echo
$imagick->getImageBlob();
}

?>