Converting pdf to jpg

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
elcorazon

Converting pdf to jpg

Post by elcorazon »

Is there a way of setting the resolution of the pdf file you are converting when convert calls gs? It appears that convert (or gs) is down sampling a pdf file to 72dpi before converting it to a jpg, causing alot of aliasing in the text. I used the -quality 100 but it doesn't seem to be having any effect on the jpg.

I manually did it using photoshop, pulled in the pdf, resized to 72dpi and same height as the one that convert made and saved it as a jpg of only 80 quality and the aliasing is almost non-existant so I know it can be done, just how with convert?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Converting pdf to jpg

Post by anthony »

-density...


See IM Examples, Postscript/PDF images
http://www.imagemagick.org/Usage/text/#postscript

PDF and PS are handled in basically the same way.

WARNING see
A word about Vector Image formats
http://www.imagemagick.org/Usage/formats/#vector
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
elcorazon

Re: Converting pdf to jpg

Post by elcorazon »

anthony wrote:-density...


See IM Examples, Postscript/PDF images
http://www.imagemagick.org/Usage/text/#postscript

PDF and PS are handled in basically the same way.

WARNING see
A word about Vector Image formats
http://www.imagemagick.org/Usage/formats/#vector
Anthony thanks. But I am still having issues trying to get the quality right. Here is what I have, maybe you can give me the best settings:

I have to convert 3 different single page pdf file sizes:

5 1/2" x 8 1/2"
6" x 9"
8 1/2" x 11"

so that the text is readable at at 72dpi with a width of 300 pixels.

Bill H

Editted with more information

I am using:

convert -density 196 pdffile.pdf -resample 72 imagefile.jpg

and getting final sizes (width x height):

5 1/2 x 8 1/2 = 396 x 612
6 x 9 = 432 x 648
8 1/2 x 11 = 612 x 792

I need to get these images to the same width (can go as high as 375 pixels wide) so they will display correctly in a flash animation and still be relatively readable.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Converting pdf to jpg

Post by anthony »

If you want a specific width... just resize the image to that width...

Code: Select all

   -resize 300x
Then just set the output density

Code: Select all

-density 72
You can NOT get set resolution to be correct for a image, and have a specific
width (unless you crop which you don't want). that are antithesis of each other.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply