Skip to content

Instantly share code, notes, and snippets.

@jedwards1211
Forked from yura/pdf2jpg.sh
Last active November 8, 2015 20:21
Show Gist options
  • Save jedwards1211/9ba64d08e46933bba231 to your computer and use it in GitHub Desktop.
Save jedwards1211/9ba64d08e46933bba231 to your computer and use it in GitHub Desktop.
script to PDF to JPG using pdftk and imagemagick
#!/bin/bash
# Script to convert PDF file to PNG images
#
# Dependencies:
# * ghostscript
for PDF in "$@"
do
echo "Processing $PDF..."
DIR=`basename "$PDF" .pdf`
mkdir "$DIR"
gs -dUseCropBox -dAutoRotatePages=/None -sDEVICE=png16m -o "$DIR"/%04d.png "$PDF"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment