Page 1 of 1

PDF to JPG - poor results

Posted: 2008-03-11T17:54:28-07:00
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 
} 

Re: PDF to JPG - poor results

Posted: 2008-03-11T18:06:22-07:00
by magick
Try the following:
  • convert -density 400 image.pdf -resize 25% image.jpg

Re: PDF to JPG - poor results

Posted: 2008-03-12T07:07:52-07:00
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.

Re: PDF to JPG - poor results

Posted: 2008-03-12T07:43:06-07:00
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.

Re: PDF to JPG - poor results

Posted: 2008-03-12T07:45:38-07:00
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.

Re: PDF to JPG - poor results >> Resolved

Posted: 2008-03-12T09:53:54-07:00
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.

Re: PDF to JPG - poor results

Posted: 2008-03-12T09:59:44-07:00
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.

Re: PDF to JPG - poor results

Posted: 2008-03-12T10:44:33-07:00
by apowell
Thanks very much for all the help - sorry it ended up being a host issue. This is a fantastic tool.