Skip to content

Instantly share code, notes, and snippets.

@kpdecker
Created April 13, 2013 19:59
Show Gist options
  • Save kpdecker/5379839 to your computer and use it in GitHub Desktop.
Save kpdecker/5379839 to your computer and use it in GitHub Desktop.
pdf-to-tiff
#!/bin/sh
# Converts PDF files to TIFF files suitible for antiquated systems.
# Usage:
# $ pdf-to-tiff.sh file1 file2
#
# Installation:
# $ brew install ghostscript
# $ brew install libtiff
# $ brew install --fresh --build-from-source imagemagick --with-libtiff
#
for file in $@; do
dir=tiff_${file%.pdf}
mkdir $dir
echo "Converting $file to $dir"
for page in `identify $file | sed -e 's/\].*$/\]/'`; do
convert -format "tiff" -density 72 -compress lzw -depth 8 -colorspace Gray "$page" "$dir/%d.tif"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment