PDF to JPG - poor results

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
apowell

PDF to JPG - poor results

Post by apowell »

I'm following up with my host on this question, but since a different server resulted in the same thing, I thought I'd post it here.

A week ago I converted a PDF to a JPG and got great results:
http://www.frontpages.ca/show.php?p=409

Today however, when I was uploading other PDFs and conerting them to JPGs, the images produced were terrible. Re-converting the other PDF resulted in this horrible image:
http://www.frontpages.ca/show.php?p=164

You can click on the image on that page to view the original PDF if that's helpful, but any PDFs are giving the same results. Any idea what could be causing this? We're using the following function - any help would be greatly appreciated.

Code: Select all

function make_thumbs($uploadedFpId,$issueFileprefix) { 
$issuePathprefix = $_SERVER['DOCUMENT_ROOT'].'/frontpages/fp/'.$issueFileprefix; 
exec('convert '.$issuePathprefix.'.pdf[0] -colorspace RGB -density 100x100 -quality 90 '.$issuePathprefix.'.jpg'); 
exec('convert '.$issuePathprefix.'.jpg -thumbnail 100x146 '.$issuePathprefix.'_sm.jpg'); // make thumbnail 
exec('convert '.$issuePathprefix.'.jpg -thumbnail 500x1000 '.$issuePathprefix.'.jpg'); // make correct size of preview 
} 
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF to JPG - poor results

Post by magick »

Try the following:
  • convert -density 400 image.pdf -resize 25% image.jpg
apowell

Re: PDF to JPG - poor results

Post by apowell »

magick wrote:Try the following:
  • convert -density 400 image.pdf -resize 25% image.jpg
Thanks - that kind of helped, as you can see in the smaller linked image, but that file is far too small. Setting the resize to the size we need resulted in the bigger image, but the quality is still not very good. Any other suggestions?

http://www.phoenixgatestudio.com/conver ... _small.jpg
http://www.phoenixgatestudio.com/conver ... _large.jpg

In setting no resize value it becomes apparent that the images on the page look okay, but the text is being severely distorted.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF to JPG - poor results

Post by magick »

Can you post the original PDF that produces the unacceptable results. We want to download it and see if we can reproduce the problem.
apowell

Re: PDF to JPG - poor results

Post by apowell »

Sure thing - here you go:
http://www.phoenixgatestudio.com/conver ... A12_01.pdf

As a side note, I thought I should add that I'm getting these results on two different servers with multiple PDFs.
apowell

Re: PDF to JPG - poor results >> Resolved

Post by apowell »

Please note that this is effectively resolved. File quality is still low on one domain, but the primary hosts looked into it and fixed something on their end to provide proper output.

Sorry for any trouble, but appreciate the help.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: PDF to JPG - poor results

Post by magick »

Right. We converted your image and it looks good. For a slight improvement, move -colorspace RGB before your PDF filename on the command-line.
apowell

Re: PDF to JPG - poor results

Post by apowell »

Thanks very much for all the help - sorry it ended up being a host issue. This is a fantastic tool.
Post Reply