LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to convert PDF to jpg? (http://www.linuxquestions.org/questions/linux-software-2/how-to-convert-pdf-to-jpg-910611/)

sholdon 10-28-2011 05: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 06:01 AM

If you have ImageMagick it's easy as
Code:

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
Code:

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

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


libCog 12-05-2011 02: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 05:56 PM

http://www.medicalnerds.com/batch-co...free-software/

jschiwal 12-06-2011 12:15 AM

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 07:52 PM.