Convert PDF to high quality JPG using PHP and ImageMagick

I pull out the hair.

I have a 300 DPI PDF that I want to turn into a 300 DPI DPI JPG, which is 2550x3300. I was told that ImageMagick can do this, so I can get ImageMagick to work, but it only returns JPG size of about 1/5 of the original PDF size.

This is not a source image. I did this with several high quality PDF files and they still have the same problems.

After cleaning up StackOverflow for ideas, this is what I came up with for use:

$im = new imagick($srcimg);
$im->setImageResolution(2550,3300);
$im->setImageFormat('jpeg');
$im->setImageCompression(imagick::COMPRESSION_JPEG); 
$im->setImageCompressionQuality(100);
$im->writeImage($targetimg);
$im->clear();
$im->destroy();

But that still doesn't work.

I also tried using $ img-> resizeImage () to resize the jpg, but then it comes out in very poor quality if the size is correct.

Totally dead end. Appreciate your help!

+6
3

. , . - , .

+8

, .

$im = new imagick();
$im->setResolution(300, 300);
$im->readImage($srcimg);
$im->setImageFormat('jpeg');
$im->setImageCompression(imagick::COMPRESSION_JPEG); 
$im->setImageCompressionQuality(100);
$im->writeImage($targetimg);
$im->clear();
$im->destroy();
+6

wie mache das immer seite 2 als jpg gespeichert wird.

how do you always save page 2 as jpg?

gruss ralf

-1
source

All Articles