5. Testing Your Scanner

Once you've completed all of the above, you're ready to test your scanner equipment. This section assumes your scanner is turned on and has been attached through the appropriate interface. If you have a SCSI or a USB scanner, at the command line you can issue the following command:

$ sane-find-scanner

...which should find and identify your scanner from a list of possible devices. (Note to Debian users: starting with Sarge, or unstable, sane-find-scanner is available in the 'sane-utils' package. In Woody it is available in the 'libsane' package.) If your scanner is a type not looked for by sane-find-scanner, you can try as root scanimage --list-devices which should yield information about attached devices. For example, this is the output on my system:
device `v4l:/dev/video0' is a Noname BT878 video (Hauppauge (bt878)) virtual device
device `epson:/dev/scanner0' is a Epson Perfection1240 flatbed scanner
whereas when using libusb it registers as
device `v4l:/dev/video0' is a Noname BT878 video (Hauppauge (bt878)) virtual device
device `epson:libusb:001:003' is a Epson Perfection1240 flatbed scanner
Make note of the 'backend:device' information obtained; this will be our device name to specifically access the scanner from the command line. Also, be aware that sane-find-scanner is a separate utility that does not guarantee support under SANE, it only looks for devices that claim to be scanners.

Next you should test the scanner's image grabbing ability. You can use either one of the frontends listed in Section 6 or at the command line if you wish with the following:

$ scanimage -d backend:/dev/scanner --format pnm > outfile.pnm

Thus if you use the Epson backend, for example, the command would be as follows:

$ scanimage -d epson:/dev/scanner --format pnm > outfile.pnm

You only need the -d option if you have more than one scanner and want to select which one to use. For example, if you have an Epson and a Mustek scanner, using "-d epson" or "-d mustek" should be enough. The complete path is only needed if you have more that one scanner supported by the same backend. Obviously /dev/scanner should be substituted with whatever scanner device you've configured (e.g., /dev/video0 in the case of a v4l device, and libusb as seen in the sane-find-scanner example above). The --format switch can be either pnm or tiff, but if left out will default to pnm. See man scanimage for more obscure but useful options. The '.pnm' format stands for 'portable anymap,' a common image format for graphical files in Linux that can be converted to nearly any other image format with Imagemagick or netpbm.