Skip to content

Instantly share code, notes, and snippets.

@mdekstrand
Created February 1, 2012 17:56
Show Gist options
  • Save mdekstrand/1718328 to your computer and use it in GitHub Desktop.
Save mdekstrand/1718328 to your computer and use it in GitHub Desktop.
Generate thumbnails of PDF files
#!/bin/sh
for file in "$@"; do
outfile="${file%%.pdf}.jpg"
echo "Thumbnailing $file to $outfile"
convert -resize 300 "$file[0]" "$outfile"
done
@mdekstrand
Copy link
Author

This script creates JPEG thumbnails of PDF files using ImageMagick. Just pass the PDF files on the command line, and it will thumbnail them to corresponding .jpg files:

$ /bin/sh pdf-thumbnail.sh *.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment