To utilize a scanner under Linux one must install the "SANE" software package. It is also wise to employ a front-end application for scanning such as Xsane. Linux uses a software interface to scanning devices known as SANE. PC's often use TWAIN. These software packages run as interfaces between the application and the scanner. SANE is like TWAIN except that it allows network access to the scanner through the saned (Networked scanner daemon). TWAIN is not network enabled and merely talks to local applications. (It is not necessary to run the saned for local applications.)
The current SANE release talks to SCSI scanners. Most non-USB scanners are SCSI scanners. Even if the scanner comes with it's own card, that card is likely a simple SCSI card with a limited feature set which can provide enough features to talk to the scanner.
See this link to see what scanners are supported by SANE: http://www.mostang.com/sane/sane-backends.html
SCSI devices under Linux are often named to suite the device. For example the first SCSI tape drive is /dev/st0. The first SCSI CD-ROM is /dev/scd0. When using scanners, one uses the "raw" device name.
|SCSI ID Number||Linux Device|
The SCSI device number 7 is usually reserved for the SCSI card itself.
To list scsi devices on Linux system: cat /proc/scsi/scsi
Set up a new logical device: As root: ln -s /dev/sgX /dev/scanner where X refers to your raw SCSI device. One may also want to change privileges for the device: chmod ugo+r /dev/sgX. (You may want to set up a group and privileges for the group if this is on a server.)
Configuration files: The defaults from the Red Hat rpm do not require any changes. Here are my samples for my HP Scanjet 5p (or any HP scanner)
#net - If this is uncommented, then it enables network access hp pnm - Used with virtual devices, i.e. GIMP. You may comment this outFile: /etc/sane.d/hp.conf (default will work) - There are many other files to provide support for other manufacturers.
scsi HP C5110A /dev/scanner
Test to see if the device is recognized: scanimage -L
device `pnm:0' is a Noname PNM file reader virtual device device `pnm:1' is a Noname PNM file reader virtual device device `hp:/dev/sgc' is a Hewlett-Packard C5110A flatbed scanner device `hp:/dev/scanner' is a Hewlett-Packard C5110A flatbed scanner
- If you don't get this, reboot the system so that the system picks up and accounts for the links and device security changes.
- Make the scanner the first with that name. For example I had an HP CR-ROM that was scsi device 4 and the HP scanner was scsi device 6. Scanimage would probe and return that the first HP device was the CD-ROM and would assume that it was the scanner. I had to change the scanner to device 2 so that it would be the first HP device scanned.
Man pages: saned, scanimage, xscanimage, sane-scsi, sane-pnm, sane-dll
Man pages on devices: sane-apple, sane-epson, sane-hp, sane-microtek, etc
See "rpm -ql sane" to see all files and man pages in package.
Look at: man sane-scsi This tells of how to recompile the kernel for a larger scsi buffer for more speed if you want to optimize your system. Red Hat should do this by default!!!!!
Yes the sane rpm package comes with xscanimage but Xsane takes alot of the pitfalls out of the operation. (but not all) Thus I recommend using Xsane as your scanning application.
- Start by issuing the command (or create a launch icon): /usr/bin/xsane
- Choose device /dev/scanner and select "Ok".
- Select options:
- "Scan" and "Color". Set the image extension (i.e. jpeg) and output file name.
- Set brightness (i.e. 50) and change output extension to jpeg (example)
- Set resolution for HP ScanJet 5p for 100 to get full size on a 17" 1280x1024 monitor
- Choose "View" + "show preview" then "Acquire Preview". See pitfall below.
- Adjust size of preview "elastic" box to fit image.
- Back on main dialog box select "Start"
Pitfalls: Note that the order of operation is important. You MUST use the preview window and do an "Aquire Preview" first before each scan. If you select the "Start" button to scan immediately, you may get nothing. To set the size in the preview window, adjust the "elastic box" or "marching ants". It is already there. The "elastic" box is already there. (you just can't see it the first time) Select the corner of the "elastic" box in the corner of the preview window. You can't see it but it is there. Just left-click at the corner of the preview window and drag. Adjust to the size of your image. Other orders of operation are possible but they may result in no real image.
Also note that if you choose the file number incrementer, that this feature maxes out at 9.
Tips: XSane 0.82
- The icons at the bottom of the main XSane options panel will reset all the defaults. I take all the defaults and then double "Gamma" to 2.0 (Black gamma slider)
- Scan resolution defaults to 100. I set it to 72 which matches most monitor resolutions.
Commercial scanning products:
- Mentalix - Java toolkits and APIs
- Tummy: XVScan - Scanning software integrated with the XV image viewer/manipulator
Sane Manual pages:
- scanimage - Command line interface
- xscanimage - Another X front end
- sane-scsi - Scsi interface
- sane-net - Using network backend
- sane-dll - Sane backend library
- Scanners: abaton - agfafocus - apple - dc25 - dmc - epson - hp - microtek - microtek2 - mustek - pint - pnm - qcam - umax
- Linux USB Device Guide
- USB Scanners under Linux
- Parallel Port Scanners under Linux
- SANE EPSON Backend home page
- SANE backend for UMAX Astra 1220P
- GQKat - CueCat Reader and Decoder - Scan barcodes using the Digital Convergence barcode reader.