Inhalt
Inhaltsverzeichnis
Vorwort
Hier kann jeder seine Scripte, betreffend Dokumente einscannen, zum Besten geben.
Dokument Arten
- Color ist mit Farbe für alle Dokument Arten tauglich.
- Black ist in Graustufen und für alle Dokument Arten tauglich.
- Lineart ist für reine Textdokumente, das ist zu bevorzugen, falls es später an eine Texterkennung (OCR) gegeben wird.
Dokumenten Container für diese Seite
Ich habe mich als Default Ordner für $HOME/tmp-copies entschieden. Als allgemeiner Ordner. Es wird mit Datum-Zeit Stempel Unterordner und Dateien gearbeitet.
Es wäre wünschenswert, den Default Ordner zu benützen, für eure Scritpe. Unterordner/Dateien nach euren Wünschen, wenn Ihr Scripte einstellt.
Ich hoffe das ist ok für euch?
Sammlung von Scripten zum Kopieren von Scannern
papercopy
papercopy erstellt jpg, die original tiff Dateien kann man behalten oder löschen lassen. Ein PDF wird auf Wunsch erzeugt.
Das ist nur eine Idee, muss nicht perfekt sein, aber entspricht meinen Wünschen, für schnelles einscannen mit Flachbrett Scanner ohne Einzugmechanik.
Vielleicht ask_tiff=false setzen, dann erscheint die Frage nicht mehr.
Das erste Zeichen darf kein Leerzeichen sein beim Speichern!
#!/bin/bash # # just a copy from scanner to file, and or not create pdf from. # # Scriptname: papercopy # # Required: sane-utils imagemagick # # Installation: # Save to /usr/local/bin/papercopy # chmod 755 /usr/local/bin/papercopy # chown root.root /usr/local/bin/papercopy ######## Variables # The folder we save the copies #copy_folder=$HOME/tmp-copies copy_folder=$HOME/tmp-copies # Scanner Device, check with scanimage --l to get a device list. # Witch commands unsterand the scanner? scanimage --help -d pixma:MG6400_192.168.0.9 # Test to see Device Errors, some scaner commands can't mixed, so run like this, to see the output.. # bash -x /usr/local/bin/papercopy # Scanner IP, recommend -> make a static IP in the Scanner # scanner_device=pixma:MG6400_192.168.0.9 scanner_device=pixma:MG6400_192.168.0.9 # The Scann Commands # This default i think is good for a Canon MG6450 #scann_command_color="--format tiff --mode Color --resolution 300 --gamma 1.65 -l 0 -t 0 -x 210mm -y 297mm" #scann_command_black="--format tiff --mode Gray --resolution 300 --gamma 2.60 -l 0 -t 0 -x 210mm -y 297mm" #scann_command_lineart="--format tiff --mode Lineart --resolution 300 --threshold 55 --threshold-curve 50 -l 0 -t 0 -x 210mm -y 297mm" scann_command_color="--format tiff --mode Color --resolution 300 --gamma 1.65 -l 0 -t 0 -x 210mm -y 297mm" scann_command_black="--format tiff --mode Gray --resolution 300 --gamma 2.60 -l 0 -t 0 -x 210mm -y 297mm" scann_command_lineart="--format tiff --mode Lineart --resolution 300 --threshold 55 --threshold-curve 50 -l 0 -t 0 -x 210mm -y 297mm" # Resize Size # You can do 1400x1800 (proportional), or fix to 1400x1800! (not proportional), or just in Prozent # But if you resize, a pdf will also be smaller! #resize_size=50% resize_size=100% # Default jpg quality #jpg_quality=80 jpg_quality=30 # Asking for tiff holding? If not say: false #ask_tiff=false ask_tiff=true # Allways keep the tiff? This force it. If yes say: true # This disable ask_tiff. #tiff_keep=true tiff_keep=false # Asking to create pdf? If not say: false #ask_pdf=false ask_pdf=true #-------------------------------- ######## Script # read Compresson Level if [ -n "$1" ];then printf "%g" "$1" &> /dev/null if [ $? -eq 0 -a "$1" -ge "1" -a "$1" -le "100" ] >/dev/null 2>&1;then jpg_quality="$1";else echo " Not a Number or out of Range";exit 0;fi fi #Create tmp Folder store_folder=$copy_folder/`date +%d.%m.%y` mkdir -p $store_folder echo echo "** just a copy from scanner to files **" echo "** and or not create pdf from if needed **" echo echo " You can call at start: papercopy 80" echo " means jpg quality level to 80 ( 1-100, actual: $jpg_quality )" echo echo " You can start copy in the same day date many times," echo " and at last you can create a pdf if needed. Or only create pdf." echo " Or you can do by Hand command, just stay in the" echo " target folder , convert *.jpg out.pdf" echo echo " Over few day's scanning to create a pdf, you need copy yourself" echo " like in nautilus to one folder, and do then the" echo " convert *.jpg out.pdf in target folder." echo if [ "$ask_tiff" == "true" -a "$tiff_keep" != "true" ];then echo echo " You want keep the .tiff Files (very Big)? [y/AnyKey(NO)]?" read -n 1 x; while read -n 1 -t .1 y; do x="$x$y"; done; if [ "$x" = "y" -o "$x" = "Y" ] >/dev/null 2>&1;then tiff_keep=true;fi fi echo echo " I store the copies pictures in $store_folder" echo echo " Scanning ? [q(quit)/c(color)/b(black)/l(lineart)]" read -n 1 x; while read -n 1 -t .1 y; do x="$x$y"; done #Here we go.. while [ "$x" != "q" -a "$x" != "Q" ];do file=`date +%d.%m.%y-%H.%M.%S`.tiff echo echo " Start scanning..." if [ "$x" = "c" -o "$x" = "C" ];then scanimage -d $scanner_device $scann_command_color > $store_folder/$file fi if [ "$x" = "b" -o "$x" = "B" ];then scanimage -d $scanner_device $scann_command_black > $store_folder/$file fi if [ "$x" = "l" -o "$x" = "L" ];then scanimage -d $scanner_device $scann_command_lineart > $store_folder/$file fi if [ "$?" != "0" ];then echo echo " Scanner device error. Exiting" echo " Maybee you make a Power Off/On cycle on the device." exit 0 fi convert $store_folder/$file -resize $resize_size -quality $jpg_quality $store_folder/`basename -s .tiff $file`.jpg > /dev/null 2>&1 if [ "$tiff_keep" != "true" ];then rm $store_folder/$file fi echo echo " Scanning ? [q(quit)/c(color)/b(black)/l(lineart)]" read -n 1 x; while read -n 1 -t .1 y; do x="$x$y"; done done if [ "$ask_pdf" == "true" ];then echo echo echo " I make a PDF from the pictures? [y/AnyKey(no)]" read -n 1 x; while read -n 1 -t .1 y; do x="$x$y"; done; if [ "$x" = "y" -o "$x" = "Y" ] >/dev/null 2>&1;then convert $store_folder/*.jpg $store_folder/`date +%d.%m.%y-%H.%M.%S`.pdf fi else echo echo echo " You can just copy&paste the following command, to make a pdf from the pictures." echo echo " convert $store_folder/*.jpg $store_folder/`date +%d.%m.%y-%H.%M.%S`.pdf" echo fi echo exit 0