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