scanimage(1) | SANE Scanner Access Now Easy | scanimage(1) |
scanimage - scan an image
scanimage [-d|--device-name dev] [--format format] [-i|--icc-profile profile] [-L|--list-devices] [-f|--formatted-device-list format] [-b|--batch [format]] [--batch-start start] [--batch-count count] [--batch-increment increment] [--batch-double] [--accept-md5-only] [-p|--progress] [-o|--output-file path] [-n|--dont-scan] [-T|--test] [-A|--all-options] [-h|--help] [-v|--verbose] [-B|--buffer-size [=size]] [-V|--version] [device-specific-options]
scanimage is a command-line interface to control image acquisition devices such as flatbed scanners or cameras. The device is controlled via command-line options. After command-line processing, scanimage normally proceeds to acquire an image. The image data is written to standard output in one of the PNM (portable aNyMaP) formats (PBM for black-and-white images, PGM for grayscale images, and PPM for color images), TIFF format (black-and-white, grayscale or color), PNG format, or JPEG format (compression level 75). scanimage accesses image acquisition devices through the SANE (Scanner Access Now Easy) interface and can thus support any device for which there exists a SANE backend (try apropos sane- to get a list of available backends).
To get a list of devices:
scanimage -L
To scan with default settings to the file image.pnm:
scanimage >image.pnm
To scan 100x100 mm to the file image.tiff (-x and -y may not be available with all devices):
scanimage -x 100 -y 100 --format=tiff >image.tiff
To print all available options:
scanimage -h
There are two sets of options available when running scanimage.
The options that are provided by scanimage itself are listed below. In addition, each backend offers its own set of options and these can also be specified. Note that the options available from the backend may vary depending on the scanning device that is selected.
Often options that are similar in function may be implemented differently across backends. An example of this difference is --mode Gray and --mode Grayscale. This may be due to differing backend author preferences. At other times, options are defined by the scanning device itself and therefore out of the control of the backend code.
Parameters are separated by a blank from single-character options (e.g. -d epson) and by a "=" from multi-character options (e.g. --device-name=epson).
will produce something like:
The --batch* options provide features for scanning documents using document feeders.
As you might imagine, much of the power of scanimage comes from the fact that it can control any SANE backend. Thus, the exact set of command-line options depends on the capabilities of the selected device. To see the options for a device named dev, invoke scanimage via a command-line of the form:
The documentation for the device-specific options printed by --help is best explained with a few examples:
-l 0..218mm [0]
The description above shows that option -l expects an option value in the range from 0 to 218 mm. The value in square brackets indicates that the current option value is 0 mm. Most backends provide similar geometry options for top-left y position (-t), width (-x) and height of scan-area (-y).
--brightness -100..100% [0]
The description above shows that option --brightness expects an option value in the range from -100 to 100 percent. The value in square brackets indicates that the current option value is 0 percent.
--default-enhancements
The description above shows that option --default-enhancements has no option value. It should be thought of as having an immediate effect at the point of the command-line at which it appears. For example, since this option resets the --brightness option, the option-pair --brightness 50 --default-enhancements would effectively be a no-op.
--mode Lineart|Gray|Color [Gray]
The description above shows that option --mode accepts an argument that must be one of the strings Lineart, Gray, or Color. The value in the square bracket indicates that the option is currently set to Gray. For convenience, it is legal to abbreviate the string values as long as they remain unique. Also, the case of the spelling doesn't matter. For example, option setting --mode col is identical to --mode Color.
--custom-gamma[=(yes|no)] [inactive]
The description above shows that option --custom-gamma expects either no option value, a "yes" string, or a "no" string. Specifying the option with no value is equivalent to specifying "yes". The value in square-brackets indicates that the option is not currently active. That is, attempting to set the option would result in an error message. The set of available options typically depends on the settings of other options. For example, the --custom-gamma table might be active only when a grayscale or color scan-mode has been requested.
Note that the --help option is processed only after all other options have been processed. This makes it possible to see the option settings for a particular mode by specifying the appropriate mode-options along with the --help option. For example, the command-line:
scanimage --help --mode color
would print the option settings that are in effect when the color-mode is selected.
--gamma-table 0..255,...
The description above shows that option --gamma-table expects zero or more values in the range 0 to 255. For example, a legal value for this option would be "3,4,5,6,7,8,9,10,11,12". Since it's cumbersome to specify long vectors in this form, the same can be expressed by the abbreviated form "[0]3-[9]12". What this means is that the first vector element is set to 3, the 9-th element is set to 12 and the values in between are interpolated linearly. Of course, it is possible to specify multiple such linear segments. For example, "[0]3-[2]3-[6]7,[7]10-[9]6" is equivalent to "3,3,3,4,5,6,7,10,8,6". The program gamma4scanimage can be used to generate such gamma tables (see gamma4scanimage(1) for details).
--filename <string> [/tmp/input.ppm]
The description above is an example of an option that takes an arbitrary string value (which happens to be a filename). Again, the value in brackets show that the option is current set to the filename /tmp/input.ppm.
scanimage uses this information to answer user authorization requests automatically. The file must have 0600 permissions or stricter. You should use this file in conjunction with the --accept-md5-only option to avoid server-side attacks. The resource may contain any character but is limited to 127 characters.
sane(7), gamma4scanimage(1), xscanimage(1), xcam(1), xsane(1), scanadf(1), sane-dll(5), sane-net(5), sane-"backendname"(5)
David Mosberger, Andreas Beck, Gordon Matzigkeit, Caskey Dickson, and many others. For questions and comments contact the sane-devel mailinglist (see http://www.sane-project.org/mailing-lists.html).
For vector options, the help output currently has no indication as to how many elements a vector-value should have.
10 Jul 2008 |