Page 1 of 1

Image output size incorrect

Posted: 2011-01-25T08:43:09-07:00
by doc_uk
Hi
I am using Imagemagic via the convert command within PHP, but am getting strange results when I grab an image of a page in a pdf. When the supplied pdf where the pages are in a landscape format, the corresponding output jpg is being put into an A4-size image, with the image at the bottom of jpg and missing the righthand 20% of the corresponding pdf page.
I am using the basic convert command within PHP, i.e. "convert pdffile.pdf[0] pdfj2peg.jpg"
I have spent 2 days going thru trying differnet commandline switches for convert, with no joy
Can anyone give me any guidance on this?
Thanks
Doc

Re: Image output size incorrect

Posted: 2011-01-25T09:24:37-07:00
by dsola
pdf files don't have a defined size, they are vectorial files. In these cases ImageMagick uses a default density of 72ppi. If you want to change this value use a command like:

convert pdffile.pdf[0] -density 150 -units pixelsperinch pdfj2peg.jpg

Re: Image output size incorrect

Posted: 2011-01-25T10:12:14-07:00
by magick
Put the -density option before the PDF image filename on the command line (e.g. -density 400 'image.pdf[0]' -resize 25% ...).

Re: Image output size incorrect

Posted: 2011-01-25T16:33:53-07:00
by doc_uk
Thank you for the prompt replies

It appears to be making image holders that are the right proportions now.

Unfortunately something which I thought I had sorted is the picture orientation - the image is 90deg CW to the image holder, i.e. a landscape-proportion pdf page has been put into a landscape-proportion image, but the image is portrait with white space to it's right

Where do I start on this?

Thanks

Doc