How can I get the best resolution using imagemagick and php?

I saved a PDF and I want to convert it to JPG and increase the photo size using imagemagick. It works fine, but it returns me a bad resolution photo http://goo.gl/Gj7bE

$save_toB = $uploaddir . "/" . $pdfNameB;
$imga2 = new imagick($pdfB . '[0]');
$imga2->scaleImage(2500, 2400);
$imga2->setImageFormat('jpg');
$imga2->writeImages($save_toB, true);

      

+3


source to share


3 answers


Add setResolution before loading the image:

Something like:

$save_toB = $uploaddir . "/" . $pdfNameB;
$imga2 = new imagick();
$imga2->setResolution(300,300);
$imga2->readImage($pdfB . '[0]')

      



Also read this: Pdf for image using php-imagick api

Hello

+3


source


http://www.php.net/manual/en/imagick.resizeimage.php

Note. The bestfit parameter behavior has changed in Imagick 3.0.0. Before this version, given the dimensions 400x400, the 200x150 image will remain untouched. Imagick 3.0.0 and later will scale to 400x300 as this is the "best fit" for the given dimensions. If the bestfit parameter is used, both width and height must be specified.



Maybe this was helpful

0


source


Accelerating the image will always result in blurry images.

Even Photoshop, which is supposed to be the most powerful imaging software, creates blurry photos when you enlarge a small photo.

These programs cannot extrapolate extra pixels to enlarge a small photo.

A better option would be to get a higher resolution image to start with.

0


source







All Articles