scanimage(1)
๐ scanimage(1) โ SANE Scanner Access Now Easy ๐
okay bestie, welcome to the scanimage page, from section 1 of the manual, brought to you by the whole SANE Scanner Access Now Easy situation. grab a snack, this one's a long one and we're only doing part 1 ๐ซถ
โจ NAME โจ
scanimage โ scan an image ๐
๐ธ SYNOPSIS ๐ธ
scanimage [-d dev] [--format=output-format] [-i profile] [-L] [-f
device-format] [-b [format]] [--batch-start=start] [--batch-count=count]
[--batch-increment=increment] [--batch-double] [--accept-md5-only] [-p]
[-o path] [-n] [-T] [-A] [-h] [-v] [-B size] [-V]
[device-specific-options]
๐ฆ DESCRIPTION ๐ฆ
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 โ that's PBM for black-and-white images, PGM for grayscale images, and PPM for color images โ or 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, iykyk ๐
๐ EXAMPLES ๐
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
๐ OPTIONS ๐
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. not their fault fr fr ๐
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).
-d dev,--device-name=devโ specifies the device to access and must be followed by a SANE device-name likeepson:/dev/sg0orhp:/dev/usbscanner0. a (partial) list of available devices can be obtained with the--list-devicesoption (see below). if no device-name is specified explicitly,scanimagereads a device-name from the environment variableSANE_DEFAULT_DEVICE. if this variable is not set,scanimagewill attempt to open the first available device. ๐--format=output-formatโ selects how image data is written to standard output or the file specified by the--output-fileoption.output-formatcan bepnm,tiff,png, orjpeg. if--formatis not specified, PNM is written by default.-i profile,--icc-profile=profileโ is used to include an ICC profile into a TIFF file. ๐จ-L,--list-devicesโ requests a (partial) list of devices that are available. the list may not be complete since some devices may be available, but are not listed in any of the configuration files (which are typically stored in directory/etc/sane.d). 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. ๐-f format,--formatted-device-list=device-formatโ works similarly to--list-devices, but requires a format string.scanimagereplaces the placeholders%d%v%m%t%i%nwith the device name, vendor name, model name, scanner type, an index number and newline respectively. the command
scanimage -f โ scanner number %i device %d is a %t, model %m,
produced by %v โ
will produce something like:
scanner number 0 device sharp:/dev/sg1 is a flatbed
scanner, model JX250 SCSI, produced by SHARP
the --batch* options provide features for scanning documents using document feeders. ๐โจ
-b [format],--batch=[format]โ 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. ifformatis not specified, the default ofout%d.pnm(orout%d.tiffor--format tiff,out%d.pngfor--format pngorout%d.jpgfor--format jpeg) will be used. this option is incompatible with the--output-pathoption.formatis given as aprintfstyle string with one integer parameter.--batch-start=startโ selects the page number to start naming files with. if this option is not given, the counter will start at1.--batch-count=countโ specifies the number of pages to attempt to scan. if not given,scanimagewill continue scanning until the scanner returns a state other thanOK. not all scanners with document feeders signal when the ADF is empty. use this option to work around them. ๐--batch-increment=incrementโ sets 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.--batch-doubleis a specific command provided to aid this.--batch-doubleโ will automatically set the increment to2. equivalent to--batch-increment=2.--batch-promptโ will ask for pressingRETURNbefore scanning a page. this can be used for scanning multiple pages without an automatic document feeder. ๐
--accept-md5-onlyโ only accepts user authorization requests that support MD5 security. the SANE network daemonsaned(8)is capable of doing such requests. ๐-p,--progressโ requests thatscanimageprints a progress counter. it shows how much image data of the current image has already been received (in percent).-o path,--output-file=pathโ requests thatscanimagesaves the scanning output to the givenpath. this option is incompatible with the--batchoption. the program will try to guess--formatfrom the file name. if that is not possible, it will print an error message and exit. ๐ญ-n,--dont-scanโ requests thatscanimageonly 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). no scan, just vibes ๐-T,--testโ requests thatscanimageperforms a few simple sanity tests to make sure the backend works as defined by the SANE API. in particular thesane_read()function is exercised by this test.-A,--all-optionsโ requests thatscanimagelists all available options exposed by the backend, including button options. the information is printed on standard output and no scan will be performed.-h,--helpโ requests help information. the information is printed on standard output and no scan will be performed. ๐ซถ-v,--verboseโ increases the verbosity of the output ofscanimage. the option may be specified repeatedly, each time increasing the verbosity level.-B [size],--buffer-size=sizeโ changes input buffer size from the default of 1MB tosizeKB.-V,--versionโ requests thatscanimageprints the program and package name, the version number of the SANE distribution that it came with and the version of the backend that it loads. if more information about the version numbers of the backends are necessary, theDEBUGvariable for the dll layer can be used. example:SANE_DEBUG_DLL=3 scanimage -L. โญ
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:
scanimage --help --device-name dev
the documentation for the device-specific options printed by --help is best explained with a few examples:
-l 0..218mm [0]
Top-left x position of scan area.
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]
Controls the brightness of the acquired image.
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
Set default values for enhancement controls.
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]
Selects the scan mode (e.g., lineart or color).
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]
Determines whether a builtin or a custom gamma-table should be used.
ok bestie that's the energy for part 1, but we are so not done โ more parts follow ๐
okay bestie, so the description above shows that option --custom-gamma expects either no option value at all, a "yes" string, or a "no" string. Specifying the option with no value is equivalent to specifying "yes". And the value in square-brackets? That means the option is not currently active โ like, attempting to set it would result in an error message. periodt, no wiggle room.
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.
Not me pointing out the plot twist: the --help option is processed only after all other options have been processed. Which is actually so iconic of it, because it 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, this command-line:
scanimage --help --mode color
would print the option settings that are in effect when the color-mode is selected. chef's kiss, truly.
--gamma-table 0..255,...โ Gamma-correction table. ๐ In color mode this option equally affects the red, green, and blue channels simultaneously (i.e., it is an intensity gamma table).
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". obsessed with this compression, lowkey โจ The program gamma4scanimage can be used to generate such gamma tables (see gamma4scanimage(1) for details).
--filename <string> [/tmp/input.ppm]โ The filename of the image to be loaded. ๐
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 shows that the option is current set to the filename /tmp/input.ppm. it's giving "show, don't tell" energy.
๐ธ ENVIRONMENT ๐ธ
SANE_DEFAULT_DEVICEโ The default device-name. yes queen, set it and forget it.
๐ฆ FILES ๐ฆ
/etc/sane.dโ This directory holds various configuration files. For details, please refer to the manual pages listed below. ๐~/.sane/passโ This file contains lines of the form
user:password:resource
scanimage uses this information to answer user authorization requests automatically. The file must have 0600 permissions or stricter. fr fr, lock it down. 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.
๐ SEE ALSO ๐
sane(7), gamma4scanimage(1), xscanimage(1), xcam(1), xsane(1), scanadf(1), sane-dll(5), sane-net(5), sane-"backendname"(5)
๐ AUTHOR ๐
David Mosberger, Andreas Beck, Gordon Matzigkeit, Caskey Dickson, and many others. the founding mothers and fathers of your scanning era, honestly. For questions and comments contact the sane-devel mailinglist (see http://www.sane-project.org/mailing-lists.html).
๐ BUGS ๐
For vector options, the help output currently has no indication as to how many elements a vector-value should have. yeah bestie, it just doesn't say. we live. ๐
and that's a wrap on scanimage(1) โ this page is from way back on 10 Jul 2008, and it's the scanimage(1) manual page, so if you ever need the deep lore, it's all still right here. go scan something cute, ily ๐ซถโจ
๐ฆ where this page comes from
- alpine 3.24: sane-doc 1.4.0-r4 ยท GPL-2.0-or-later GPL-2.0-or-later-with-sane-exception Public-Domain
- arch rolling: sane 1.4.0-4 ยท GPL-2.0-or-later AND LicenseRef-GPL-2.0-or-later-with-linking-exception
- debian trixie: sane-utils 1.3.1-3+b1 ยท GPL-2.0-or-later WITH sane exception
- fedora 43: sane-backends 1.4.0-4.fc43 ยท GPL-2.0-or-later WITH SANE-exception AND GPL-2.0-or-later AND GPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND IJG AND MIT
- fedora 44: sane-backends 1.4.0-6.fc44 ยท GPL-2.0-or-later WITH SANE-exception AND GPL-2.0-or-later AND GPL-2.0-only AND LGPL-2.0-or-later AND LGPL-2.1-or-later AND LicenseRef-Fedora-Public-Domain AND IJG AND MIT
- opensuse-leap 16.0: sane-backends 1.3.0-bp160.1.14 ยท GPL-2.0-or-later AND SUSE-GPL-2.0+-with-sane-exception AND SUSE-Public-Domain
- opensuse-leap 16.0: sane-backends 1.3.0-bp160.1.14 ยท GPL-2.0-or-later AND SUSE-GPL-2.0+-with-sane-exception AND SUSE-Public-Domain
- opensuse-leap 16.0: sane-backends 1.3.0-bp160.1.14 ยท GPL-2.0-or-later AND SUSE-GPL-2.0+-with-sane-exception AND SUSE-Public-Domain
- opensuse-leap 16.0: sane-backends 1.3.0-bp160.1.14 ยท GPL-2.0-or-later AND SUSE-GPL-2.0+-with-sane-exception AND SUSE-Public-Domain
- ubuntu questing: sane-utils 1.3.1-4build1
- ubuntu resolute: sane-utils 1.4.0-1ubuntu1 ยท GPL-2.0-or-later WITH sane exception
- ubuntu stonking: sane-utils 1.4.0-1ubuntu2 ยท GPL-2.0-or-later WITH sane exception
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms