Scanner Access Now Easy

A play on 'TWAIN', SANE is an API for accessing scanners, originally designed for linux1. TWAIN was designed as a scanner API for windows 3.x, and is a very simple API indeed - an application using TWAIN invokes a 'TWAIN data source', and then accepts any images the TWAIN data source gives it. The TWAIN data source is responsible for the entire scanning process, from providing the user interface to driving the scanner. While the data source may use a scanner driver to do the heavy lifting, there is no standard interface between data sources and drivers.

The TWAIN framework allows for great flexability - an application that uses TWAIN can take input from any device that has a TWAIN data source, such as a digital camera, motion capture card, or FAX machine. As the TWAIN data source defines its own user-interface, advanced features of high-end scanners (film scanning, document feeders, etc.) can be easily supported. Despite this flexability, TWAIN has major architectural flaws. Because the user-interface is defined by the data source, two different scanners on the same computer with the same operating system invoked by the same application can have wildly differing user interfaces. If a data source has a horrible user interface (and many do), there's nothing the user can do about it. There is no way to automate scanning using TWAIN, as there is no standard for the application to communicate with the data source in any way more meaningful than opening and closing it.

SANE solves these architectural issues by defining a rigid interface between the 'front end', which takes care of the user interface, and the 'back end', which communicates with the scanner. Whichever scanner is used, the front-end stays the same; the user interface remains consistent, greatly improving the user's experience. Applications can provide their own front ends, for instance a kids' application could provide a simplified, easy-to-use front end.

The greatest advantage of SANE's front end/back end architecture, however, is that the front end and back end do not have to be on the same computer. saned, the SANE network daemon, allows scanners to be shared over the network. Rather than having one scanner per seat, or a dedicated 'scanning workstation', as is necessary with TWAIN, a single scanner can be connected to a linux server, and can be used by any computer on the network. In the best case, this saves having several unused scanners; at worst it still saves having to dedicate a workstation to scanning.

SANE scanners can be shared with windows machines by installing a TWAIN data source on the windows machines to access saned. SaneTwain (http://sanetwain.ozuzo.net/) is free beer, well-featured and stable. There also exist network frontends for Mac OS X, OS/2 and NeXTStep. SANE comes with backends for a large number of SCSI, parallel, and USB scanners, but has the same problems as linux in supporting deviced for which the specifications are not available. There's no technical reason why companies opposed to open-source could not release their own closed-source backends, but to my knowledge, none have.

SANE is licensed under the GPL, and is downloadable from http://www.sane-project.org/sane-supported-devices.html . It is bundled with many linux distributions, including Debian and Red Hat.


1 - While originally designed for linux, there is a windows/cygwin port of SANE, supporting SCSI scanners only. At time of writing, it is very much work-in-progress. It can be found at http://fz.eryx.net/sane/windows/sane_on_windows.html