Skip to content

Instantly share code, notes, and snippets.

@levex
Last active August 13, 2018 13:11
Show Gist options
  • Save levex/2ecf011096cf6774aeecbd3eaae2e690 to your computer and use it in GitHub Desktop.
Save levex/2ecf011096cf6774aeecbd3eaae2e690 to your computer and use it in GitHub Desktop.
Convert a PDF's first page to JPG on Fedora
#!/bin/bash
WHAT=$1
WHERE=$2
[[ -z $WHAT ]] && echo Usage: $0 \<what\> \<to-where\> && exit 1
[[ -z $WHERE ]] && echo Usage: $0 \<what\> \<to-where\> && exit
_TMPFILE=$(mktemp)
qpdf --empty --pages ${WHAT} 1 -- ${_TMPFILE}
gs -o ${WHERE} -sDEVICE=jpeg -dLastPage=1 ${_TMPFILE}
rm ${_TMPFILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment