Last active
August 13, 2018 13:11
-
-
Save levex/2ecf011096cf6774aeecbd3eaae2e690 to your computer and use it in GitHub Desktop.
Convert a PDF's first page to JPG on Fedora
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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