This method uses the ImageMagick "-density {$x_resolution}x{$y_resolution}" parameter
(PECL imagick 2, PECL imagick 3)
Imagick::setImageResolution — Establece la resolución de la imagen
Establece la resolución de la imagen.
x_resolution
y_resolution
Devuelve true
en caso de éxito.
Lanza ImagickException en caso de error.
Ejemplo #1 Imagick::setImageResolution()
<?php
function setImageResolution($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->setImageResolution(50, 50);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
This method uses the ImageMagick "-density {$x_resolution}x{$y_resolution}" parameter
Note that any changes to the resolution (-density option) must be made before specifying the file, so construct the object with no file path and then use $object->readImage('path/to/file'); otherwise the density won't change.
Also see Imagick::setResolution.