1

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.

andrew.46
  • 39,359

1 Answers1

4

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

binfalse
  • 889