-   Linux - Software (
-   -   How to convert PDF to jpg? (

sholdon 10-28-2011 04:41 AM

How to convert PDF to jpg?
I have hundreds of multipage pdf documents that I would like to save out as jpg's files.
I know I can convert them individually but if anyone knows a program that could do this for me automatically that would be great

colucix 10-28-2011 05:01 AM

If you have ImageMagick it's easy as

convert file.pdf file.jpg
this will create a JPEG for every single page of the original document. If you want to improve the quality, you can try some options, e.g

convert -colorspace RGB -interlace none -density 300x300 -quality 100 file.pdf file.jpg
To do multiple conversions, you can do a loop:

for file in *.pdf
 convert -colorspace RGB -interlace none -density 300x300 -quality 100 $file ${file/pdf/jpg}

libCog 12-05-2011 01:22 PM

If these PDFs are simply scans (raster, not vector), then "converting" is not the best approach. In this case, you should simply extract the images from the PDF container using "pdfimages" (it's stock on most distros). It's easy to script something using pdfimages.

If these are vector PDFs, then I don't know what's the best approach.. perhaps ImageMagick.. although I think I recall IM having issues with vector PDFs.

jefro 12-05-2011 04:56 PM

jschiwal 12-05-2011 11:15 PM

Do you want to convert every page of a multipage PDF and convert it to an image?
Do these PDFs contain collections of photo's that you want to extract, or are they regular PDFs with text?

The poppler-tools package contains pdf processing programs including the "pdfimages" program.
To convert every page of a pdf to an image, there is the "pdftoppm" program. Can then use ImageMagick's "convert" program to convert the ppm files to jpegs or another image format.

All times are GMT -5. The time now is 04:02 AM.