Skip to content

Instantly share code, notes, and snippets.

@khufkens
Created April 14, 2017 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khufkens/95e8e093d1a5e68beed23b38cbc12c1a to your computer and use it in GitHub Desktop.
Save khufkens/95e8e093d1a5e68beed23b38cbc12c1a to your computer and use it in GitHub Desktop.
Converts PDF figures to tiff files for publication
#!/bin/bash
# batch convert pdf to tiff files
# takes one argument, resolution in dpi
# use: pdf2tiff.sh 150
# will convert all pdfs in the current
# directory to tiff files at 150dpi
files=`ls *.pdf`
for i in $files;do
# get the filename without the extension
noextension=`echo $i | sed 's/\(.*\)\..*/\1/'`
filename=`echo $noextension.tif`
echo $filename
gs -q -dNOPAUSE -r$1 -sDEVICE=tiff24nc -sCompression=lzw -sOutputFile=$filename $i -c quit
done
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment