Created
March 9, 2017 09:25
-
-
Save BookGin/69bdf4366e0c1b7ca6df3555c62f1f7c to your computer and use it in GitHub Desktop.
pdf2img
This file contains hidden or 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
#!/usr/bin/env bash | |
if [ $# != 1 ]; then | |
echo "Usage: $0 [filename]" | |
exit 1 | |
fi | |
lastdir=`pwd` | |
tmpdir=`mktemp -d --suffix=-pdf2img` | |
echo "temp dir: $tmpdir" | |
convert -density 144 $1 "$tmpdir/%d.png" | |
total_files=`ls -1 $tmpdir | wc -l` | |
cd $tmpdir | |
inputfiles="" | |
for i in `seq 0 $[total_files-1]`; do | |
inputfiles+="$i.png " | |
done | |
convert $inputfiles out.pdf | |
mv out.pdf $lastdir/pdfimg-$1 | |
echo "output: $lastdir/pdfimg-$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment