How to batch convert PDFs to Jpgs

This is mainly for my own future reference, but might be useful to others. First things first, I had to clean up the PDF filenames, some contained spaces, some did not.

rename 'y/ /-/' *

This will replace all spaces with hyphens (-).

Now for the converting process:

for i in `ls *.pdf`; do convert -density 125 "$i" "$i".jpg; done

This will convert all .pdf files in the current directory. It requires imagemagik to be installed (on Ubuntu you will be given instructions on how to do this if it’s not already installed when you run the command).

The option “-density 125” can be adjusted to produce different sized Jpg files, the higher the number, the higher the resolution and consequently the file size.

Multipage PDF to Individual Images

The following will take a multipage PDF (input.pdf) and convert it to web ready (RGB) jpeg files named output.jpg

convert -colorspace RGB input.pdf -profile sRGB.icc output%d.jpg