Image size after pdf to jpg convert

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
makrell66
Posts: 7
Joined: 2007-02-06T00:55:36-07:00

Image size after pdf to jpg convert

Post by makrell66 »

I'm using the following command to convert pdf files to jpg file :

convert -colorspace rgb file.pdf file.jpg

The pdf file is 11,3 x 15,75 inches in size.
The resulting file is a 72dpi 612x792 pixel jpg file.

I want it to be 72dpi, so that is ok. But, I only see the 612x792 pixels from the bottom left corner of the original pdf. This size is the exact size of a US letter format.

So, I assume that IM is using US letter as a default for the output size.

Can this be changed? Or, is there another way I can perform the conversion and get a correct jpg image?
The size I want would be a 814x1134 pixel image.

- m66 -
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Image size after pdf to jpg convert

Post by fmw42 »

set the density of the pdf to a high value so as to produce something close to the pixel resolution that you want or higher, then resize to the exact size you want.

convert -colorspace rgb -density XX file.pdf -resize 814x1134 file.jpg

try XX=150

The result may not be exactly what you want because the ratio of 814/612 is not equal to 1134/792. So your resize may need to be either cropped or padded depending upon how you do your resize (with or without ^)

Alternately, you can use different densities for your pdf in X and Y, but then the output may be distorted

72*814/612=95.8
72*1134/792=103.1

so

convert -colorspace rgb -density 95.8x103.1 file.pdf file.jpg


see http://www.imagemagick.org/script/comma ... hp#density
makrell66
Posts: 7
Joined: 2007-02-06T00:55:36-07:00

Re: Image size after pdf to jpg convert

Post by makrell66 »

Hi,

Thanks for your answers.
fmw42 wrote: convert -colorspace rgb -density XX file.pdf -resize 814x1134 file.jpg

try XX=150
When I try this, I get a 814x1053 pixel jpg at 150dpi.
But the image only shows the lower left part of the original pdf.
fmw42 wrote: Alternately, you can use different densities for your pdf in X and Y, but then the output may be distorted

72*814/612=95.8
72*1134/792=103.1

so

convert -colorspace rgb -density 95.8x103.1 file.pdf file.jpg
When I try this, I get a jpg at 814x1134 pixels, 95dpi horizontal and 103dpi vertical.
But still the image consists only of the lower left part of the original pdf.

- m66 -
makrell66
Posts: 7
Joined: 2007-02-06T00:55:36-07:00

Re: Image size after pdf to jpg convert

Post by makrell66 »

Problem is solved.

I used an old version of IM, and installing the latest version solved the problem.
Now I only run the command

convert -colorspace rgb file.pdf file.jpg

and the resulting jpg file is a perfect 72dpi jpg file of the original pdf.

- m66 -
Post Reply