summaryrefslogtreecommitdiff
path: root/pdf2png.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pdf2png.sh')
-rwxr-xr-xpdf2png.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/pdf2png.sh b/pdf2png.sh
new file mode 100755
index 0000000..37c30b8
--- /dev/null
+++ b/pdf2png.sh
@@ -0,0 +1,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