Source

scripts / scan-batch.sh

Full commit
#!/bin/sh

# prefix is the first argument or "scan" if none
if [ $1 ]; then SLUG="$1"; else SLUG="scan"; fi
DIRNAME="`date +'%Y-%m-%d_%H%M'`_$SLUG"

mkdir $DIRNAME
cd $DIRNAME

echo Scanning to ${DIRNAME}...

scanimage --progress --format tiff --batch='page-%d.tiff'

# convert tiff→jpeg

for f in `ls *.tiff`
do
    base=`basename $f .tiff`
    convert "$f" "${base}.jpg"
done;

# cleanup

rm *.tiff