Last active
December 15, 2015 07:49
-
-
Save qoobaa/5226690 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 | |
while true; do | |
DEVICE=$(scanimage -f "%d%n" | grep epjitsu) | |
mkdir -p /tmp/scanner | |
rm /tmp/scanner/out*.pnm 2> /dev/null | |
TIMESTAMP=$(date +%Y%m%d%H%M%S) | |
scanimage -d $DEVICE --mode Lineart --resolution 300 --source "ADF Duplex" --batch=/tmp/scanner/out%03d.pnm 2> /dev/null | |
if [ -f /tmp/scanner/out001.pnm ]; then | |
for file in /tmp/scanner/out*.pnm; do | |
# unpaper -dv 5 --dpi 300 -mt 0.05 --overwrite $file $file | |
convert $file -trim $file | |
# identify $file | grep 1x1 && rm $file | |
done | |
convert -page 2480x3508 -gravity center /tmp/scanner/out*.pnm /home/kuba/Dropbox/Scans/$TIMESTAMP.pdf | |
rm /tmp/scanner/out*.pnm | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment