From: Martin Pitt Date: Mon, 25 Feb 2008 12:55:34 +0000 (+0100) Subject: add scandoc X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=67c238efb01593f944f51bba956e53f5fbe88d92;p=bin.git add scandoc --- diff --git a/scandoc b/scandoc new file mode 100755 index 0000000..1918261 --- /dev/null +++ b/scandoc @@ -0,0 +1,27 @@ +#!/bin/sh -e + +name="$1" +[ -n "$name" ] || { + echo "Usage: $0 " + exit 1 +} +name=$(readlink -f "$name") + +D=`mktemp -d` +cd "$D" +echo "Output file directory: $D" +PAGE=0 +while true; do + PAGE=$((PAGE+1)) + scanimage --resolution 150 --mode Gray -x 210 -y 297 | convert -rotate 180 -modulate 120 -level 30,60% - cur.png + FNAME=page`printf '%02i' $PAGE` + pngquant 4 < cur.png > $FNAME.png + convert $FNAME.png $FNAME.pdf + echo "Insert next page and press Enter; q to stop" + read x + [ "$x" = q ] && break || true +done + +pdfjoin --outfile "$name" page*.pdf + +#rm -rf "$D"