scan2pdf: reduce colors and enhance scanned documents
authorDan White <dan@whiteaudio.com>
Tue, 21 Aug 2018 21:14:27 +0000 (16:14 -0500)
committerDan White <dan@whiteaudio.com>
Tue, 21 Aug 2018 21:14:27 +0000 (16:14 -0500)
scan2pdf [new file with mode: 0755]

diff --git a/scan2pdf b/scan2pdf
new file mode 100755 (executable)
index 0000000..37e3b3e
--- /dev/null
+++ b/scan2pdf
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# ImageMagick utility to sharpen and reduce colors in scanned documents
+#
+
+if [ "$1" == "-h" -o "$1" == "--help" ]; then
+    echo "usage: scan2pdf input.pdf output.pdf"
+    exit 1
+fi
+
+INFILE="$1"
+OUTFILE="$2"
+
+
+convert \
+    -density 300 \
+    "$INFILE" \
+    +dither \
+    -colors 64 \
+    -black-threshold 50% \
+    -fuzz 20% -fill white -opaque white \
+    -extent 2550x3300 \
+    -compress zip \
+    "$OUTFILE"
+