Reputation: 614
How do i change image resolution using Imagick. I have learnt and notice that setResolution change image density, but not resolution. i wish to make the image resolution to 12800 * 800 pixel resolution
$image = new Imagick();
$image->setResolution(72,72) ; // it change only image density.
$image->readImage($img);
Upvotes: 1
Views: 3800
Reputation: 2783
What you're looking for is setImageResolution
. More information here
This in combination with resampleImage
should give the desired result. link
$image = new Imagick();
$image->setImageResolution(12800,800) ; // it change only image density.
$image->resampleImage (12800,800,imagick::FILTER_UNDEFINED,1);
$image->readImage($img);
Copying the information found on this page:
This method uses the "convert -density {$x_resolution}x{$y_resolution}" parameter. However be aware, that Imagick::setResolution() is much more alike the "convert -density" option than Imagick::setImageResolution()
It's very irritating that both Imagick::setResolution() and Imagick::setImageResolution() are introduced with "Sets the image resolution."
Upvotes: 2