Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

More precisely: Given a folder containing images in pdf-format (each of which has a name of the form NAME.pdf, with NAME being composed of several words separated by spaces), how do I batch convert the images to jpg-format and preserve their names in the form NAME.jpg ? (Using pdftoppm as indicated in "How to convert a .pdf file into a folder of images?" seems rather complicated, since it requires treating each image separately.)

share|improve this question

1 Answer 1

You can use convert from imagemagick to convert a PDF into an image.

To install it, use the following command:

sudo apt-get install imagemagick 

To convert all PDFs in a directory, go to that directory and run the following command:

for i in *.pdf; do convert "$i" "${i%.*}.jpg"; done

ImageMagick documentation | Bash string manipulation

share|improve this answer
    
That will not work for files with spaces in the name ("NAME being composed of several words separated by spaces). You have to quote the variables. –  bodhi.zazen Oct 1 '13 at 19:57
    
I've edited the answer to reflect this. –  SirCharlo Oct 1 '13 at 20:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.