Scanning and Scanner Serving for GNU/Linux and Windows

This document explains how to setup a scanner for use in Debian GNU/Linux. It goes on to describe how to enable that scanner for remote use from workstations running Debian GNU/Linux, other unices or Microsoft Windows.

Introduction to the SANE Project

The SANE (Scanner Access Now Easy) project (http://www.sane-project.org/) produces the following groups of software:

sane-backends

Debian unstable package page: http://packages.debian.org/unstable/libs/libsane

This package includes:

sane-frontends

Debian unstable package page: http://packages.debian.org/unstable/graphics/sane

This package includes:

XSane

XSane is available for Unix and Windows. The XSane project web site is at http://www.xsane.org/, the Debian unstable package page at http://packages.debian.org/unstable/graphics/xsane.

Setting it up using Debian GNU/Linux

Install Scanner Software (Debian-specific)

Install 'sane', which includes all the software from the SANE project mentioned above.

Setup the Machine for Local Scanning

How the scanners attached and what your system uses to access it

There are a number of different interfaces your scanner can be attached to

There are a number of different methods used by the system to access the scanner, depending on interface and possibly Linux kernel version

There are a number of different locations for the scanner, depending on interface and means of accessing the scanner

We need to identify the means being used to access your scanner and its location. You can use either of the following, whilst root

Test the scanner

scanimage -d backend-name:location --format tiff > image.tif.
For example:

Backend

The backend is specific to the scanner manufacturer and sometimes the model.. The means of accessing the scanner must be defined in the backed configuration file. The backend configuration file is /etc/sane.d/backend-name.conf. The backend for most Hewlett Packard scanners is called 'hp' (the project page is at: http://www.kirchgessner.net/sanehpfaq.html). The backend for most Epson scanners is called 'epson' (the project page is at http://www.freecolormanagement.com/sane/).

For USB scanners, where the system uses libusb and where the backend knows the scanner, using just 'usb' in the backend configuration file should be enough to use the scanner; this instructs the backed to scan for all Epson scanners it knows.

For USB scanners, where the system uses libusb, if the backend doesn't know your scanner, for example if its a newer model, you'll have to put the vendor and product IDs, as reported by sane-find-scanner -v, into the backend configuration file. The output from sane-find-scanner -v should have given you a vendor ID and product ID.
(The documentation in the configuration file says to use the syntax 'usb <product ID> <device ID>', which is different wording to that given by sane-find-scanner. sane-find-scanner uses the term 'vendor' to mean the same as the configuration file's 'product' and 'product' to mean the same as the configuration file's 'device'. The configuration file also leaves out the leading zeros (i.e. usb 0x04b8 0x0103) displayed by sane-find-scanner, but you can either use them or leave them out.

For USB scanners, where the system uses devfs, you use one of the locations listed earlier.

For SCSI scanners, use the name of the generic SCSI device that the scanner is connected to, for example /dev/sg3 or /dev/scanner, or just scsi BACKEND-NAME.

References

For a detailed description of each backend's configuration file, see the relevant backend manual page, called 'sane-<backend-name>' (e.g., sane-epson and sane-hp).

Permissions

If the system uses libusb and the backend knows your scanner, permissions should be setup correctly for you automatically. (see http://www.khk.net/sane/libusb.html and possibly http://jmccoy.sdf-us.org/linux/config/scanner.php for background on this.

Note: need to add here how to setup permissions if the system uses libusb and the backend doesn't know the scanner. See (see http://www.khk.net/sane/libusb.html.

If the system uses devfs, set permissions in the configuration file /etc/devfs/conf.d/scanner (/etc/devfs/perms on some non-Debian systems), in the following manner (your specific location may differ to these examples):

Changes to the permissions of the device itself are lost when disconnecting and re-connecting the device or restarting the system.

Note: it may be necessary to set devfs permissions using chgrp scanner /dev/sg3 and either chmod g+rw /dev/sg3 or chmod o+rw /dev/sg3.

Setup the Machine as a Remote Scanner Server - saned

saned is the SANE (Scanner Access Now Easy) daemon that allows remote clients to access image acquisition devices available on the local host.

  1. configuration file: saned.conf - contains a list of accepted clients
  2. add this to /etc/inetd.conf:
    sane stream tcp nowait saned.saned /usr/sbin/saned saned
  3. The Debian package automatically adds this for you to /etc/services:
    sane 6566/tcp # SANE network scanner daemon
    (Note: Debian uses 'sane' where as the SANE project's documentation uses 'sane-port'. It looks as though 'sane-port' will be replaced in the IANA ports specification with 'sane')

Scanning from a Remote Location

scanimage

We don't think scanimage can be used remotely.

XSane (Unix)

Package(s): xscan

XSane (Windows)

Package(s): xscan

To install in Windows: extract the zip archive to C:\sane. Do not place it in any other place, XSane will only work when placed in C:\sane.

"XSane future plans: free installation path; autodetect language; may be xsane-win32 without cygwin.dll on native win32 mode; may be later we make a sane-WIN32 version so that the backends do work too." - http://www.xsane.org/xsane-future.html

"Viewer-Mode: is completly usable (does gocr run on windows?)" - http://www.xsane.org/xsane-win32.html

[Note: elaborate on copy, fax, email and OCR]

Other Software

Kooka

Project web site: http://www.kde.org/apps/kooka/

A raster image scan program for KDE.

Quiteinsane

Project web site: http://packages.debian.org/unstable/graphics/quiteinsane

"QuiteInsane is a graphical frontend for SANE (Scanner Access Now Easy). It can save an image to a file in a variety of image formats, send an image to a printer or do OCR (Optical Character Recognition) using gocr."

SaneTwain (Windows only)

Project web site: http://sanetwain.ozuzo.net/

Requires SaneTwain.ds be copied to %WINDIR%\twain_32. This is then picked up by programs looking for a Twain driver. The program ScanImage.exe can be used to run the scanning software directly, however you'll want to weigh up the different interfaces of xscan and SaneTwain (which has a native Windows GUI; also, in a rough test of memory comsumption on startup, SaneTwain used 5MB RAM, xsane 13MB; xsane is cross platform).

(when the server isn't available its difficult to use - first time it loaded it asked for the address, then on subsequent loads it looked without asking then hung when it didn't find the device.)

Tame/2

Project web site: http://www.os2world.com/goran/tame.htm

Scanner Software Integration into Other Software

OpenOffice

"OpenOffice.org includes a simple scan interface that uses SANE" (is this just on GNU/Linux?) Insert -> Picture -> Scan -> Request... - for us this loaded SaneTwain, presumably bcos it looks for a Twain source. If it only supports Twain on Windows then its probably worth having SaneTwain installed as well as XSane.

GIMP

...

Further Info

SANE Frequently Asked Questions: http://www.xs4all.nl/~ljm/SANE-faq.html

/usr/share/doc/sane-utils/README.debian - information on permissions

various documents in file:////usr/share/doc/xsane/html/ or file:////usr/share/doc/xsane-common/html/

sane-usb(5) man page

sane-scsi(5) man page

http://penguin-breeder.org/sane/saned/

SANE Search Engine Server: http://sane.informatik.uni-freiburg.de/

troubleshooting: http://www.fifi.org/doc/libsane/README.Debian

XSane newsletter and mailing list: http://www.xsane.org/xsane-mailinglist.html

Related

open-source character recognition: http://jocr.sourceforge.net/

A few scanning tips by Wayne Fulton: http://www.scantips.com/

Scanning Negatives with GIMP: http://www.khk.net/color/gimp_negative_scanning.html

Error!

permissions? read readme.linux

The home of the Epson SANE backend is at http://www.khk.net/sane/index.html. Their documentation says it supports Epson GT-8500 but the SANE projefct's doesn't list it.
http://www.khk.net/sane latest advertised epson backend is version 0.2.34 from 2003-02-15
from the sane-backends source code, 1.0.15 includes "SANE Epson Backend v0.2.43 - 2004-10-16"

Optical Character Recognition (OCR)

gocr

Project web site: http://jocr.sourceforge.net/

can't get gocr to work with xsane

To Do

Checkout scsiadd: http://llg.cubic.org/tools/

Checkout scsiaddgui (not available in Debian): http://www.8ung.at/klappnase/scsiaddgui/scsiaddgui.html

Troubleshooting:
SANE_DEBUG_=255 gimp
SANE_DEBUG_DLL=255 gimp
SANE_DEBUG_NET=255 gimp