#!/bin/bash # -*- coding: iso-8859-1 -*- # (c) 2009 Thomas Guettler http://www.thomas-guettler.de/ # This script is in the public domain # Scan images with sane and create a small, color reduced pdf. # See "scanimage -A" for a list of possible modes. #MODE="True Gray" MODE="24bit Color" RES=200 COLORS=7 XSIZE=800 temp=$(mktemp) count=0 echo "Dateinamen (ohne .pdf) eingeben:" read pdfname pdfname="$pdfname.pdf" # DINA4 FORMAT="-l 0 -t 0 -x 210 -y 296" while true; do out=$(printf "${temp}_%02d.pnm" $count) scanimage -p --mode "$MODE" --resolution $RES $FORMAT > $out ret=$? if [ ! -s "$out" ]; then rm -f "$out"; fi if [ $ret != 0 ]; then break; fi let "count+=1" while true; do echo "Noch eine Seite (j/n)? (Falls j, bitte vorher neue Seite einlegen)" read antwort if [ "$antwort" = "j" -o "$antwort" = "n" ]; then break fi done if [ "$antwort" = "n" ]; then break; fi echo " ... naechster Scan" done ls ${temp}_*.pnm 2>/dev/null || exit echo "Erstelle $pdfname" convert +dither -unsharp x+2.0 -thumbnail ${XSIZE}x -colors $COLORS -compress zip -page a4+0+0 -adjoin ${temp}_*.pnm $pdfname ls -lh $pdfname evince $pdfname &