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 -
Image size after pdf to jpg convert
- 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
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
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
Hi,
Thanks for your answers.
But the image only shows the lower left part of the original pdf.
But still the image consists only of the lower left part of the original pdf.
- m66 -
Thanks for your answers.
When I try this, I get a 814x1053 pixel jpg at 150dpi.fmw42 wrote: convert -colorspace rgb -density XX file.pdf -resize 814x1134 file.jpg
try XX=150
But the image only shows the lower left part of the original pdf.
When I try this, I get a jpg at 814x1134 pixels, 95dpi horizontal and 103dpi vertical.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
But still the image consists only of the lower left part of the original pdf.
- m66 -
Re: Image size after pdf to jpg convert
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 -
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 -