Page 1 of 1

PDF to PNG conversion with good quality.

Posted: 2012-09-05T04:30:46-07:00
by h2shin
I've been searching around for a while and still can't find a way to use imagick to convert a pdf file to a png file with good original quality.

I'm in need of converting pdf documents containing text as well as images to png files, in such a way that image/text is sharp and clear. Is there a way to do this within imagick?

All my attempts so far have been less than fruitful.

Re: PDF to PNG conversion with good quality.

Posted: 2012-09-05T13:55:35-07:00
by fmw42
Use supersampling technique. Increase the density, then resize by the inverse of the density increase.

convert -density 288 image.pdf -resize 25% output.png

normal density is 72. So 72*4=288. Thus resize is 1/4=25%

Re: PDF to PNG conversion with good quality.

Posted: 2012-09-05T14:02:58-07:00
by h2shin
But what about with the imagick extension? I really don't know how to work my way around that extension...

Re: PDF to PNG conversion with good quality.

Posted: 2012-09-05T14:08:20-07:00
by fmw42
h2shin wrote:But what about with the imagick extension? I really don't know how to work my way around that extension...

Sorry you will need to find the equivalent operations in Imagick. I am not an expert on Imagick. But see http://php.net/manual/en/book.imagick.php and resizeImage() and setImageResolution()