summaryrefslogtreecommitdiff
path: root/pdf2png.sh
blob: 37c30b80186145d74d3fb9e3e63dfce78136a079 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

#strip the file name off the input PDF
file="$(ls ""$1"" | sed 's|\.pdf||g')"

#convert the PDF to a 600px wide PNG image
pdftoppm -singlefile -png -scale-to-x 696 -scale-to-y -1 "$1" "$file"

#add a 2x2px border to the image.png file
convert "$file".png -bordercolor black -border 2x2 "$file".png

#compress the image
optipng "$file".png