How to use scanner from command line in Linux
Some time ago I had the need to scan a lot of single page documents. I had always used Simple Scan (Document Scanner in the last Ubuntu versions) with satisfaction, but to be quicker automatizing work as much as possible I had to use the command line.
Simple Scan is only a GUI so it cannot be used from the command line.
The command to interact with the scanner is scanimage
. This command comunicates with the SANE interface and permits to control the scanner.
The scanimage
man page presents a lot of options, I used only some of them.
scanimage -d epson2 --mode=Gray --resolution=150 -o /tmp/sample.jpg
-d
name of device to use,epson2
in my case. Usescanimage -L
with the scanner on to obtain the list of devices.--mode
scan mode.--resolution
resolution to use (this option is specific of the epson scanner).-o
output file. Looking the filename extension, the command try to understand the format to use.
Thanks to this script I have been able to speed up the tedious operations and to reduct the manual part: now I need only to put the document into the scanner and type the output file name.