man-pages/man1/scanimage.1.html
2021-03-31 01:06:50 +01:00

766 lines
17 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of scanimage</TITLE>
</HEAD><BODY>
<H1>scanimage</H1>
Section: SANE Scanner Access Now Easy (1)<BR>Updated: 10 Jul 2008<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="ixAAB"></A>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
scanimage - scan an image
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>scanimage</B>
[<B>-d</B>|<B>--device-name</B>
<I>dev</I>]
[<B>--format</B>
<I>format</I>]
[<B>-i</B>|<B>--icc-profile</B>
<I>profile</I>]
[<B>-L</B>|<B>--list-devices</B>]
[<B>-f</B>|<B>--formatted-device-list</B>
<I>format</I>]
[<B>-b</B>|<B>--batch</B>
[=<I>format</I>]]
[<B>--batch-start</B>
<I>start</I>]
[<B>--batch-count</B>
<I>count</I>]
[<B>--batch-increment</B>
<I>increment</I>]
[<B>--batch-double</B>]
[<B>--accept-md5-only</B>]
[<B>-p</B>|<B>--progress</B>]
[<B>-o</B>|<B>--output-file</B>]
[<B>-n</B>|<B>--dont-scan</B>]
[<B>-T</B>|<B>--test</B>]
[<B>-A</B>|<B>--all-options</B>]
[<B>-h</B>|<B>--help</B>]
[<B>-v</B>|<B>--verbose</B>]
[<B>-B</B>|<B>--buffer-size</B>
[=<I>size</I>]]
[<B>-V</B>|<B>--version</B>]
[<I>device-specific-options</I>]
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>scanimage</B>
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,
<B>scanimage</B>
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.
<B>scanimage</B>
accesses image acquisition devices through the
<B>SANE</B>
(Scanner Access Now Easy) interface and can thus support any device for which
there exists a
<B>SANE</B>
backend (try
<B>apropos</B>
<I>sane-</I>
to get a list of available backends).
<P>
<A NAME="lbAE">&nbsp;</A>
<H2>EXAMPLES</H2>
To get a list of devices:
<P>
<BR>&nbsp;&nbsp;scanimage&nbsp;-L
<P>
To scan with default settings to the file image.pnm:
<P>
<BR>&nbsp;&nbsp;scanimage&nbsp;&gt;image.pnm
<P>
To scan 100x100 mm to the file image.tiff (-x and -y may not be available with
all devices):
<P>
<BR>&nbsp;&nbsp;scanimage&nbsp;-x&nbsp;100&nbsp;-y&nbsp;100&nbsp;--format=tiff&nbsp;&gt;image.tiff
<P>
To print all available options:
<P>
<BR>&nbsp;&nbsp;scanimage&nbsp;-h
<P>
<A NAME="lbAF">&nbsp;</A>
<H2>OPTIONS</H2>
<B>Remark:</B> Parameter are defined by the backends. So are --mode Gray and --mode Grayscale in use.
Please read the backend documentation first.
<P>
Parameters are separated by a blank from single-character options (e.g.
-d epson) and by a &quot;=&quot; from multi-character options (e.g. --device-name=epson).
<P>
<P>
The
<B>-d</B>
or
<B>--device-name</B>
options must be followed by a
<B>SANE</B>
device-name like
`<I>epson:/dev/sg0</I>'
or
`<I>hp:/dev/usbscanner0</I>'.
A (partial) list of available devices can be obtained with the
<B>--list-devices</B>
option (see below). If no device-name is specified explicitly,
<B>scanimage</B>
reads a device-name from the environment variable
<B>SANE_DEFAULT_DEVICE</B>.
If this variable is not set,
<B>scanimage</B>
will attempt to open the first available device.
<P>
The
<B>--format</B>
<I>format</I>
option selects how image data is written to standard output or the file specified by
the --output-file option.
<I>format</I>
can be
<B>pnm</B>,
<B>tiff</B>,
<B>png</B>,
or
<B>jpeg</B>.
If
<B>--format</B>
is not specified, PNM is written by default.
<P>
The
<B>-i</B>
or
<B>--icc-profile</B>
option is used to include an ICC profile into a TIFF file.
<P>
The
<B>-L</B>
or
<B>--list-devices</B>
option requests a (partial) list of devices that are available. The
list is not complete since some devices may be available, but are not
listed in any of the configuration files (which are typically stored
in directory
<I>@CONFIGDIR@</I>).
This is particularly the case when accessing scanners through the network. If
a device is not listed in a configuration file, the only way to access it is
by its full device name. You may need to consult your system administrator to
find out the names of such devices.
<P>
The
<B>-f</B>
or
<B>--formatted-device-list</B>
option works similar to
<B>--list-devices</B>,
but requires a format string.
<B>scanimage</B>
replaces the placeholders
<B>%d %v %m %t %i %n</B>
with the device name, vendor name, model name, scanner type, an index
number and newline respectively. The command
<P>
<DL COMPACT><DT id="1"><DD>
<B>scanimage -f</B>
<I>`` scanner number %i device %d is a %t, model %m, produced by %v ''</I>
<P>
</DL>
will produce something like:
<P>
<DL COMPACT><DT id="2"><DD>
scanner number 0 device sharp:/dev/sg1 is a flatbed scanner, model JX250
SCSI, produced by SHARP
</DL>
<P>
The
<B>--batch*</B>
options provide the features for scanning documents using document
feeders.
<B>--batch</B>
[<I>format</I>]
is used to specify the format of the filename that each page will be written
to. Each page is written out to a single file. If
<I>format</I>
is not specified, the default of out%d.pnm (or out%d.tif for --format tiff,
out%d.png for --format png or out%d.jpg for -- format jpeg) will be used.
This option is incompatible with the --output-path option.
<I>format</I>
is given as a printf style string with one integer parameter.
<B>--batch-start</B>
<I>start</I>
selects the page number to start naming files with. If this option is not
given, the counter will start at 1.
<B>--batch-count</B>
<I>count</I>
specifies the number of pages to attempt to scan. If not given,
scanimage will continue scanning until the scanner returns a state
other than OK. Not all scanners with document feeders signal when the
ADF is empty, use this command to work around them.
With
<B>--batch-increment</B>
<I>increment</I>
you can change the amount that the number in the filename is incremented
by. Generally this is used when you are scanning double-sided documents
on a single-sided document feeder. A specific command is provided to
aid this:
<B>--batch-double</B>
will automatically set the increment to 2.
<B>--batch-prompt</B>
will ask for pressing RETURN before scanning a page. This can be used for
scanning multiple pages without an automatic document feeder.
<P>
The
<B>--accept-md5-only</B>
option only accepts user authorization requests that support MD5 security. The
<B>SANE</B>
network daemon
(<B>saned</B>)
is capable of doing such requests. See
<B><A HREF="/cgi-bin/man/man2html?8+saned">saned</A></B>(8).
<P>
The
<B>-p</B>
or
<B>--progress</B>
option requests that
<B>scanimage</B>
prints a progress counter. It shows how much image data of the current image has
already been received by
<B>scanimage</B>
(in percent).
<P>
The
<B>-o</B>
or
<B>--output-file</B>
option requests that
<B>scanimage</B>
saves the scanning output to the given path. This option is incompatible with the
--batch option. The program will try to guess --format from the file name.
If that is not possible, it will print an error message and exit.
<P>
The
<B>-n</B>
or
<B>--dont-scan</B>
option requests that
<B>scanimage</B>
only sets the options provided by the user but doesn't actually perform a
scan. This option can be used to e.g. turn off the scanner's lamp (if
supported by the backend).
<P>
The
<B>-T</B>
or
<B>--test</B>
option requests that
<B>scanimage</B>
performs a few simple sanity tests to make sure the backend works as
defined by the
<B>SANE</B>
API (in particular the
<B>sane_read</B>
function is exercised by this test).
<P>
The
<B>-A</B>
or
<B>--all-options</B>
option requests that
<B>scanimage</B>
lists all available options exposed the backend, including button options.
The information is printed on standard output and no scan will be done.
<P>
The
<B>-h</B>
or
<B>--help</B>
options request help information. The information is printed on
standard output and in this case, no attempt will be made to acquire
an image.
<P>
The
<B>-v</B>
or
<B>--verbose</B>
options increase the verbosity of the operation of
<B>scanimage.</B>
The option may be specified repeatedly, each time increasing the verbosity
level.
<P>
The
<B>-B</B>
option without argument changes the input buffer size from the default 32KB to 1MB. For finer grained control, use
<B>--buffer-size=</B>
followed by the number of KB.
<P>
The
<B>-V</B>
or
<B>--version</B>
option requests that
<B>scanimage</B>
prints the program and package name, the version number of
the
<B>SANE</B>
distribution that it came with and the version of the backend that it
loads. Usually that's the dll backend. If more information about the version
numbers of the backends are necessary, the
<B>DEBUG</B>
variable for the dll backend can be used. Example: SANE_DEBUG_DLL=3 scanimage
-L.
<P>
As you might imagine, much of the power of
<B>scanimage</B>
comes from the fact that it can control any
<B>SANE</B>
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
<I>dev</I>,
invoke
<B>scanimage</B>
via a command-line of the form:
<P>
<DL COMPACT><DT id="3"><DD>
<B>scanimage --help --device-name</B>
<I>dev</I>
</DL>
<P>
The documentation for the device-specific options printed by
<B>--help</B>
is best explained with a few examples:
<P>
<BR>&nbsp;-l&nbsp;0..218mm&nbsp;[0]
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;Top-left&nbsp;x&nbsp;position&nbsp;of&nbsp;scan&nbsp;area.
<P>
<DL COMPACT><DT id="4"><DD>
The description above shows that option
<B>-l</B>
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).
</DL>
<P>
<P>
<BR>&nbsp;--brightness&nbsp;-100..100%&nbsp;[0]
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;Controls&nbsp;the&nbsp;brightness&nbsp;of&nbsp;the&nbsp;acquired&nbsp;image.
<P>
<DL COMPACT><DT id="5"><DD>
The description above shows that option
<B>--brightness</B>
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.
</DL>
<P>
<BR>&nbsp;--default-enhancements
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;Set&nbsp;default&nbsp;values&nbsp;for&nbsp;enhancement&nbsp;controls.
<P>
<DL COMPACT><DT id="6"><DD>
The description above shows that option
<B>--default-enhancements</B>
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
<B>--brightness</B>
option, the option-pair
<B>--brightness 50 --default-enhancements</B>
would effectively be a no-op.
</DL>
<P>
<BR>&nbsp;--mode&nbsp;Lineart|Gray|Color&nbsp;[Gray]
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;Selects&nbsp;the&nbsp;scan&nbsp;mode&nbsp;(e.g.,&nbsp;lineart&nbsp;or&nbsp;color).
<P>
<DL COMPACT><DT id="7"><DD>
The description above shows that option
<B>--mode</B>
accepts an argument that must be one of the strings
<B>Lineart</B>,
<B>Gray</B>,
or
<B>Color</B>.
The value in the square bracket indicates that the option is currently
set to
<B>Gray</B>.
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
<B>--mode col</B>
is identical to
<B>--mode Color</B>.
</DL>
<P>
<BR>&nbsp;--custom-gamma[=(yes|no)]&nbsp;[inactive]
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;Determines&nbsp;whether&nbsp;a&nbsp;builtin&nbsp;or&nbsp;a&nbsp;custom&nbsp;gamma-table
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;should&nbsp;be&nbsp;used.
<P>
<DL COMPACT><DT id="8"><DD>
The description above shows that option
<B>--custom-gamma</B>
expects either no option value, a &quot;yes&quot; string, or a &quot;no&quot; string.
Specifying the option with no value is equivalent to specifying &quot;yes&quot;.
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
<B>--custom-gamma</B>
table might be active only when a grayscale or color scan-mode has
been requested.
<P>
Note that the
<B>--help</B>
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
<B>--help</B>
option. For example, the command-line:
<P>
<B>scanimage --help --mode</B>
<I>color</I>
<P>
would print the option settings that are in effect when the color-mode
is selected.
</DL>
<P>
<BR>&nbsp;--gamma-table&nbsp;0..255,...
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;Gamma-correction&nbsp;table.&nbsp;&nbsp;In&nbsp;color&nbsp;mode&nbsp;this&nbsp;option
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;equally&nbsp;affects&nbsp;the&nbsp;red,&nbsp;green,&nbsp;and&nbsp;blue&nbsp;channels
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;simultaneously&nbsp;(i.e.,&nbsp;it&nbsp;is&nbsp;an&nbsp;intensity&nbsp;gamma&nbsp;table).
<P>
<DL COMPACT><DT id="9"><DD>
The description above shows that option
<B>--gamma-table</B>
expects zero or more values in the range 0 to 255. For example, a
legal value for this option would be &quot;3,4,5,6,7,8,9,10,11,12&quot;. Since
it's cumbersome to specify long vectors in this form, the same can be
expressed by the abbreviated form &quot;[0]3-[9]12&quot;. 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,
&quot;[0]3-[2]3-[6]7,[7]10-[9]6&quot; is equivalent to &quot;3,3,3,4,5,6,7,10,8,6&quot;.
The program
<B>gamma4scanimage</B>
can be used to generate such gamma tables (see
<B><A HREF="/cgi-bin/man/man2html?1+gamma4scanimage">gamma4scanimage</A></B>(1)
for details).
</DL>
<P>
<BR>
<BR>&nbsp;--filename&nbsp;&lt;string&gt;&nbsp;[/tmp/input.ppm]
<BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;The&nbsp;filename&nbsp;of&nbsp;the&nbsp;image&nbsp;to&nbsp;be&nbsp;loaded.
<P>
<DL COMPACT><DT id="10"><DD>
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
<B>/tmp/input.ppm</B>.
</DL>
<P>
<A NAME="lbAG">&nbsp;</A>
<H2>ENVIRONMENT</H2>
<DL COMPACT>
<DT id="11"><B>SANE_DEFAULT_DEVICE</B>
<DD>
The default device-name.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<DT id="12"><I>@CONFIGDIR@</I>
<DD>
This directory holds various configuration files. For details, please
refer to the manual pages listed below.
<DT id="13"><I>~/.sane/pass</I>
<DD>
This file contains lines of the form
</DL>
<P>
<DL COMPACT><DT id="14"><DD>
user:password:resource
<P>
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.
</DL>
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?7+sane">sane</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?1+gamma4scanimage">gamma4scanimage</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+xscanimage">xscanimage</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+xcam">xcam</A>(1)</B>,
<B><A HREF="/cgi-bin/man/man2html?1+xsane">xsane</A>(1)</B>,
<B><A HREF="/cgi-bin/man/man2html?1+scanadf">scanadf</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?5+sane-dll">sane-dll</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+sane-net">sane-net</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+sane-backendname">sane-backendname</A></B>(5)
<A NAME="lbAJ">&nbsp;</A>
<H2>AUTHOR</H2>
David Mosberger, Andreas Beck, Gordon Matzigkeit, Caskey Dickson, and many
others. For questions and comments contact the sane-devel mailinglist (see
<A HREF="http://www.sane-project.org/mailing-lists.html).">http://www.sane-project.org/mailing-lists.html).</A>
<P>
<A NAME="lbAK">&nbsp;</A>
<H2>BUGS</H2>
For vector options, the help output currently has no indication as to
how many elements a vector-value should have.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="15"><A HREF="#lbAB">NAME</A><DD>
<DT id="16"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="17"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="18"><A HREF="#lbAE">EXAMPLES</A><DD>
<DT id="19"><A HREF="#lbAF">OPTIONS</A><DD>
<DT id="20"><A HREF="#lbAG">ENVIRONMENT</A><DD>
<DT id="21"><A HREF="#lbAH">FILES</A><DD>
<DT id="22"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="23"><A HREF="#lbAJ">AUTHOR</A><DD>
<DT id="24"><A HREF="#lbAK">BUGS</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:26 GMT, March 31, 2021
</BODY>
</HTML>