Created
May 6, 2012 09:37
-
-
Save qoobaa/2621259 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
DEVICE=$(scanimage -f "%d%n" | grep epjitsu) | |
while true; do | |
rm out*.pnm 2> /dev/null | |
TIMESTAMP=$(date +%Y%m%d%H%M%S) | |
scanimage -d $DEVICE --mode Lineart --resolution 300 --source "ADF Duplex" -b 2> /dev/null | |
if [ -f out1.pnm ]; then | |
for file in out*.pnm; do | |
unpaper -dv 5 -ni 15 --dpi 300 -mt 0.05 --overwrite $file $file | |
convert $file -fuzz 15% -trim -shave 1%x1% -fuzz 15% -trim $file | |
identify $file | grep 1x1 && rm $file | |
done | |
convert -page 2480x3508 -gravity center out*.pnm $TIMESTAMP.pdf | |
rm out*.pnm | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment