3

I have stored a PDF, and I want to convert it to JPG and increasing the size of the photo with imagemagick. It works ok, but It return me a photo with bad resolution 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);
Kakitori
  • 901
  • 6
  • 16
  • 41

3 Answers3

3

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 to image using php-imagick api

Regards

Community
  • 1
  • 1
Sacx
  • 6,276
  • 4
  • 22
  • 29
0

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

Note: The behavior of the parameter bestfit changed in Imagick 3.0.0. Before this version given dimensions 400x400 an image of dimensions 200x150 would be left untouched. In Imagick 3.0.0 and later the image would be scaled up to size 400x300 as this is the "best fit" for the given dimensions. If bestfit parameter is used both width and height must be given.

maybe it was helpful

0

Upscaling an image will always result in blurry images.

Even Photoshop, which is supposed to be the most powerful image manipulation software produces blurred photos when you enlarge a small photo.

These software are not able to extrapolate the extra pixels needes to enlarge a small photo.

The best option would be to pick up a higher res image to start with.

Gunjan Karun
  • 765
  • 1
  • 8
  • 18