Skip to content

Instantly share code, notes, and snippets.

@dpavlin
Created October 14, 2016 11:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpavlin/6b52a7115178b7aa2c93f6cfaf8547b8 to your computer and use it in GitHub Desktop.
Save dpavlin/6b52a7115178b7aa2c93f6cfaf8547b8 to your computer and use it in GitHub Desktop.
Scan pages using Sane's scanimage and convert them to pdf (with page and pdf preview using qiv and mupdf)
#!/bin/sh -e
nr=1
mkdir $1
while true ; do
file=$1/`printf "%04d" $nr`.jpg
echo "scanning page $nr -> $file"
scanimage --progress --resolution 300 --format jpg -l 0mm -t 0mm -x 210mm -y 297mm > $file
qiv $file
echo "enter = one more page, anything else to convert to $1.pdf"
read wait_for_key
if [ ! -z "$wait_for_key" ] ; then
convert $1/*.jpg $1.pdf
mupdf $1.pdf
ls -al $1.pdf
exit 0
fi
nr=`expr $nr + 1`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment