1scanimage(1) SANE Scanner Access Now Easy scanimage(1)
2
3
4
6 scanimage - scan an image
7
9 scanimage [-d|--device-name dev] [--format format] [-i|--icc-profile
10 profile] [-L|--list-devices] [-f|--formatted-device-list format]
11 [--batch [=format]] [--batch-start start] [--batch-count count]
12 [--batch-increment increment] [--batch-double] [--accept-md5-only]
13 [-p|--progress] [-n|--dont-scan] [-T|--test] [-h|--help] [-v|--verbose]
14 [-B|--buffer-size [=size]] [-V|--version] [device-specific-options]
15
17 scanimage is a command-line interface to control image acquisition
18 devices such as flatbed scanners or cameras. The device is controlled
19 via command-line options. After command-line processing, scanimage
20 normally proceeds to acquire an image. The image data is written to
21 standard output in one of the PNM (portable aNyMaP) formats (PBM for
22 black-and-white images, PGM for grayscale images, and PPM for color
23 images) or in TIFF (black-and-white, grayscale or color). scanimage
24 accesses image acquisition devices through the SANE (Scanner Access Now
25 Easy) interface and can thus support any device for which there exists
26 a SANE backend (try apropos sane- to get a list of available backends).
27
28
30 To get a list of devices:
31
32 scanimage -L
33
34 To scan with default settings to the file image.pnm:
35
36 scanimage >image.pnm
37
38 To scan 100x100 mm to the file image.tiff (-x and -y may not be avail‐
39 able with all devices):
40
41 scanimage -x 100 -y 100 --format=tiff >image.tiff
42
43 To print all available options:
44
45 scanimage -h
46
47
49 Parameters are separated by a blank from single-character options (e.g.
50 -d epson) and by a "=" from multi-character options (e.g.
51 --device-name=epson).
52
53
54 The -d or --device-name options must be followed by a SANE device-name
55 like `epson:/dev/sg0' or `hp:/dev/usbscanner0'. A (partial) list of
56 available devices can be obtained with the --list-devices option (see
57 below). If no device-name is specified explicitly, scanimage reads a
58 device-name from the environment variable SANE_DEFAULT_DEVICE. If this
59 variable is not set, scanimage will attempt to open the first available
60 device.
61
62 The --format format option selects how image data is written to stan‐
63 dard output. format can be pnm or tiff. If --format is not used, PNM
64 is written.
65
66 The -i or --icc-profile option is used to include an ICC profile into a
67 TIFF file.
68
69 The -L or --list-devices option requests a (partial) list of devices
70 that are available. The list is not complete since some devices may be
71 available, but are not listed in any of the configuration files (which
72 are typically stored in directory /etc/sane.d). This is particularly
73 the case when accessing scanners through the network. If a device is
74 not listed in a configuration file, the only way to access it is by its
75 full device name. You may need to consult your system administrator to
76 find out the names of such devices.
77
78 The -f or --formatted-device-list option works similar to
79 --list-devices, but requires a format string. scanimage replaces the
80 placeholders %d %v %m %t %i %n with the device name, vendor name, model
81 name, scanner type, an index number and newline respectively. The com‐
82 mand
83
84 scanimage -f “ scanner number %i device %d is a %t, model %m,
85 produced by %v ”
86
87 will produce something like:
88
89 scanner number 0 device sharp:/dev/sg1 is a flatbed scanner,
90 model JX250 SCSI, produced by SHARP
91
92 The --batch* options provide the features for scanning documents using
93 document feeders. --batch [format] is used to specify the format of
94 the filename that each page will be written to. Each page is written
95 out to a single file. If format is not specified, the default of
96 out%d.pnm (or out%d.tif for --format tiff) will be used. format is
97 given as a printf style string with one integer parameter.
98 --batch-start start selects the page number to start naming files with.
99 If this option is not given, the counter will start at 0.
100 --batch-count count specifies the number of pages to attempt to scan.
101 If not given, scanimage will continue scanning until the scanner
102 returns a state other than OK. Not all scanners with document feeders
103 signal when the ADF is empty, use this command to work around them.
104 With --batch-increment increment you can change the amount that the
105 number in the filename is incremented by. Generally this is used when
106 you are scanning double-sided documents on a single-sided document
107 feeder. A specific command is provided to aid this: --batch-double
108 will automatically set the increment to 2. --batch-prompt will ask for
109 pressing RETURN before scanning a page. This can be used for scanning
110 multiple pages without an automatic document feeder.
111
112 The --accept-md5-only option only accepts user authorization requests
113 that support MD5 security. The SANE network daemon (saned) is capable
114 of doing such requests. See saned(8).
115
116 The -p or --progress option requests that scanimage prints a progress
117 counter. It shows how much image data of the current image has already
118 been received by scanimage (in percent).
119
120 The -n or --dont-scan option requests that scanimage only sets the
121 options provided by the user but doesn't actually perform a scan. This
122 option can be used to e.g. turn off the scanner's lamp (if supported by
123 the backend).
124
125 The -T or --test option requests that scanimage performs a few simple
126 sanity tests to make sure the backend works as defined by the SANE API
127 (in particular the sane_read function is exercised by this test).
128
129 The -h or --help options request help information. The information is
130 printed on standard output and in this case, no attempt will be made to
131 acquire an image.
132
133 The -v or --verbose options increase the verbosity of the operation of
134 scanimage. The option may be specified repeatedly, each time increas‐
135 ing the verbosity level.
136
137 The -B or --buffer-size changes the input buffer size from 32KB to the
138 number kB specified or 1M.
139
140 The -V or --version option requests that scanimage prints the program
141 and package name, the version number of the SANE distribution that it
142 came with and the version of the backend that it loads. Usually that's
143 the dll backend. If more information about the version numbers of the
144 backends are necessary, the DEBUG variable for the dll backend can be
145 used. Example: SANE_DEBUG_DLL=3 scanimage -L.
146
147 As you might imagine, much of the power of scanimage comes from the
148 fact that it can control any SANE backend. Thus, the exact set of com‐
149 mand-line options depends on the capabilities of the selected device.
150 To see the options for a device named dev, invoke scanimage via a com‐
151 mand-line of the form:
152
153 scanimage --help --device-name dev
154
155 The documentation for the device-specific options printed by --help is
156 best explained with a few examples:
157
158 -l 0..218mm [0]
159 Top-left x position of scan area.
160
161 The description above shows that option -l expects an option
162 value in the range from 0 to 218 mm. The value in square brack‐
163 ets indicates that the current option value is 0 mm. Most back‐
164 ends provide similar geometry options for top-left y position
165 (-t), width (-x) and height of scan-area (-y).
166
167
168 --brightness -100..100% [0]
169 Controls the brightness of the acquired image.
170
171 The description above shows that option --brightness expects an
172 option value in the range from -100 to 100 percent. The value
173 in square brackets indicates that the current option value is 0
174 percent.
175
176 --default-enhancements
177 Set default values for enhancement controls.
178
179 The description above shows that option --default-enhancements
180 has no option value. It should be thought of as having an imme‐
181 diate effect at the point of the command-line at which it
182 appears. For example, since this option resets the --brightness
183 option, the option-pair --brightness 50 --default-enhancements
184 would effectively be a no-op.
185
186 --mode Lineart|Gray|Color [Gray]
187 Selects the scan mode (e.g., lineart or color).
188
189 The description above shows that option --mode accepts an argu‐
190 ment that must be one of the strings Lineart, Gray, or Color.
191 The value in the square bracket indicates that the option is
192 currently set to Gray. For convenience, it is legal to abbrevi‐
193 ate the string values as long as they remain unique. Also, the
194 case of the spelling doesn't matter. For example, option set‐
195 ting --mode col is identical to --mode Color.
196
197 --custom-gamma[=(yes|no)] [inactive]
198 Determines whether a builtin or a custom gamma-table
199 should be used.
200
201 The description above shows that option --custom-gamma expects
202 either no option value, a "yes" string, or a "no" string. Spec‐
203 ifying the option with no value is equivalent to specifying
204 "yes". The value in square-brackets indicates that the option
205 is not currently active. That is, attempting to set the option
206 would result in an error message. The set of available options
207 typically depends on the settings of other options. For exam‐
208 ple, the --custom-gamma table might be active only when a
209 grayscale or color scan-mode has been requested.
210
211 Note that the --help option is processed only after all other
212 options have been processed. This makes it possible to see the
213 option settings for a particular mode by specifying the appro‐
214 priate mode-options along with the --help option. For example,
215 the command-line:
216
217 scanimage --help --mode color
218
219 would print the option settings that are in effect when the
220 color-mode is selected.
221
222 --gamma-table 0..255,...
223 Gamma-correction table. In color mode this option
224 equally affects the red, green, and blue channels
225 simultaneously (i.e., it is an intensity gamma table).
226
227 The description above shows that option --gamma-table expects
228 zero or more values in the range 0 to 255. For example, a legal
229 value for this option would be "3,4,5,6,7,8,9,10,11,12". Since
230 it's cumbersome to specify long vectors in this form, the same
231 can be expressed by the abbreviated form "[0]3-[9]12". What
232 this means is that the first vector element is set to 3, the
233 9-th element is set to 12 and the values in between are interpo‐
234 lated linearly. Of course, it is possible to specify multiple
235 such linear segments. For example, "[0]3-[2]3-[6]7,[7]10-[9]6"
236 is equivalent to "3,3,3,4,5,6,7,10,8,6". The program
237 gamma4scanimage can be used to generate such gamma tables (see
238 gamma4scanimage(1) for details).
239
240 --filename <string> [/tmp/input.ppm]
241 The filename of the image to be loaded.
242
243 The description above is an example of an option that takes an
244 arbitrary string value (which happens to be a filename). Again,
245 the value in brackets show that the option is current set to the
246 filename /tmp/input.ppm.
247
248
250 SANE_DEFAULT_DEVICE
251 The default device-name.
252
254 /etc/sane.d
255 This directory holds various configuration files. For details,
256 please refer to the manual pages listed below.
257
258 ~/.sane/pass
259 This file contains lines of the form
260
261 user:password:resource
262
263 scanimage uses this information to answer user authorization
264 requests automatically. The file must have 0600 permissions or
265 stricter. You should use this file in conjunction with the
266 --accept-md5-only option to avoid server-side attacks. The
267 resource may contain any character but is limited to 127 charac‐
268 ters.
269
271 sane(7), gamma4scanimage(1), xscanimage(1), xcam(1), xsane(1),
272 scanadf(1), sane-dll(5), sane-net(5), sane-"backendname"[22m(5)
273
275 David Mosberger, Andreas Beck, Gordon Matzigkeit, Caskey Dickson, and
276 many others. For questions and comments contact the sane-devel mail‐
277 inglist (see http://www.sane-project.org/mailing-lists.html).
278
279
281 For vector options, the help output currently has no indication as to
282 how many elements a vector-value should have.
283
284
285
286 10 Jul 2008 scanimage(1)