HomeImagickImagickDrawImagickPixelImagick Pixel IteratorImagick KernelDevelopmentTutorial Source codeReport an issue
Category
Example

Imagick::setImageResolution

← setImagePixelColor   setImageTicksPerSecond →
Sets the image resolution.
Sets the image resolution, which is a hint to printers of what size to print the image i.e. how many dots per inch it should be printed at. This function does not affect the pixel dimensions of the image, and so does not have a noticeable effect on the image on a computer, which does not use the DPI setting to render an image.

Example

function setImageResolution($image_path)
{
    $imagick = new \Imagick(realpath($image_path));
    $imagick->setImageResolution(50, 50);
    
    header("Content-Type: image/jpeg");
    echo $imagick->getImageBlob();
}