Image output size incorrect

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
doc_uk
Posts: 2
Joined: 2011-01-25T08:00:29-07:00
Authentication code: 8675308

Image output size incorrect

Post 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
dsola
Posts: 2
Joined: 2011-01-25T07:00:44-07:00
Authentication code: 8675308

Re: Image output size incorrect

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Image output size incorrect

Post by magick »

Put the -density option before the PDF image filename on the command line (e.g. -density 400 'image.pdf[0]' -resize 25% ...).
doc_uk
Posts: 2
Joined: 2011-01-25T08:00:29-07:00
Authentication code: 8675308

Re: Image output size incorrect

Post 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
Post Reply