Quality PDF>Image

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
Rebel

Quality PDF>Image

Post by Rebel »

Hello,

I am using ghostscript and imagemagicK to convert pdf files to images,
but it looks like the images get resized :S?
and the quality is really poor.

Do you know how i can change this.
i have tried all the filters en quality option etc.

my script:

Code: Select all

$strPDF = "Flash.pdf";
//exec("/usr/bin/convert " . escapeshellarg($strPDF) . " -colorspace RGB -quality 100 " . escapeshellarg("map/flash.jpg"));

`convert Flash.pdf -colorspace RGB -quality 100% bestand.png`;
echo '<img src="bestand.png">';
?>

I am also looking for something to check how much pages the pdf has? i read something about ping?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Quality PDF>Image

Post by magick »

To get high quality rendered PDF pages try supersampling:
  • convert -density 400 image.pdf -resize 25% image.png
Rebel

Re: Quality PDF>Image

Post by Rebel »

Wow thanks alot.

The script is really powerfull :O

nice build i need to say!

Do you also know about how to count the PDF pages. (i need it for echoing the images afterwords ;))
or do i need to go to someone ho knowes ghostscript?

Thanks anyway for the quality issue
caribbean pirate

Re: Quality PDF>Image

Post by caribbean pirate »

Use PDF to Images Converter to convert your PDF documents and save PDF files as different images format including JPEG, PNG, TIFF, GIF, BMP, PCX, TGA etc.

Image

With PDF to Images tool, you can convert multiple PDF documents at once; you can select any pages to convert ; you can set options for your images format like output type, output colour and resolution...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Quality PDF>Image

Post by fmw42 »

Rebel wrote:Wow thanks alot.

The script is really powerfull :O

nice build i need to say!

Do you also know about how to count the PDF pages. (i need it for echoing the images afterwords ;))
or do i need to go to someone ho knowes ghostscript?

Thanks anyway for the quality issue
convert rose: rose: rose: rose.pdf

echo `convert rose.pdf -format "%n" info:` | cut -d\ -f1
3

Note there seems to be a problem with just using:
convert rose.pdf -format "%n" info:
3
3
3

I will report it.
Mazin
Posts: 10
Joined: 2008-11-24T13:30:50-07:00

Re: Quality PDF>Image

Post by Mazin »

Sorry if I'm bumping this from too long ago.

I'd like to point out that counting PDF pages with ImageMagick can be more intensive than you think. Even if you use identify instead of convert, ghostscript will still crunch through the entire PDF. If it's a big PDF, you might just find your CPU maxed and memory consumed until you're out of memory (at least on my 6.5.7-8).
Post Reply