Page 1 of 1
Image size after pdf to jpg convert
Posted: 2011-10-20T05:37:07-07:00
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 -
Re: Image size after pdf to jpg convert
Posted: 2011-10-20T09:53:23-07:00
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
Re: Image size after pdf to jpg convert
Posted: 2011-10-20T23:25:09-07:00
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 -
Re: Image size after pdf to jpg convert
Posted: 2011-10-21T02:30:30-07:00
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 -