php8.5
Home/ Manual/ imagick / imagick/ Imagick::setImageResolution

Imagick::setImageResolution

PHP function Edit on GitHub ✎

(PECL imagick 2, PECL imagick 3)

Sets the image resolution

Description

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

Sets the image resolution.

Parameters

x_resolution
y_resolution

Return Values

Success

Errors/Exceptions

Throws

Examples

Imagick::setImageResolution()

php
<?php
function setImageResolution($imagePath) {
    $imagick = new \Imagick(realpath($imagePath));
    $imagick->setImageResolution(50, 50);
    
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}

?>

Source: reference/imagick/imagick/setimageresolution.xml · from the official PHP manual (php/doc-en)