[sane-devel] Scan from command-line

Jeremy jeremy at acjlaw.net
Mon Jan 11 15:15:17 UTC 2010


On Saturday 09 January 2010, Josu Lazkano wrote:
> Hello, I just installed Sane and configure my scanner. I want make a script
> that works this way:
> 
> ./scan Document1
> 
> This will send a mail to an specific sender with the subject Document1 with
> an image scanned.
> 
> How can I scan a document from the comman-line? I need to configure scanner
> options?
> 
> I am new on this, I jut used the x-window program.
> 
> Thanks for all and best regards..
> 

I use a bash script "bscan" for batch scanning documents.
<http://www.acjlaw.net:8080/~jeremy/Ricoh/scripts/bscan.html>
It uses sane's scanimage and various netpbm utilities for format conversions.

The first time you run the script it will create ~/.bscanrc and setup various 
defaults which you can later change to suit yourself. 
It currently doesn't automatically email, but it does have an option to print 
(--format=lp) which should be trivial to modify to pipe the result to your
mail program.

For instance,
to scan a document in grayscale to pnm and convert to a bitonal pdf:
bscan --mode=8-bit --shades=2 --page=Letter --comp=lzw -bw --format=pdf FILE

or to print to a printer:
bscan --mode=8-bit --shades=2 --page=Letter --comp=lzw -bw --format=lp

Bug reports welcome.



More information about the sane-devel mailing list