Batch converting images

Had a bunch of very large pdf images that needed to be scaled down to be included into a thesis. Converting to jpg in ubuntu seemed to bring file sizes down. Here is some bash code to run in a terminal that converts all pdfs in the current folder to .jpg with the given ppi value (currently 300) using convert. Just change file extensions if you want to change input or output format.

for file in *.pdf; do convert -units PixelsPerInch "$file" -density 300 ${file%.pdf}.jpg; done
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s