b-lux HOWTO - Using a photographic scanner in Linux
There is now good support for the main commercially available photographic scanners. The 'scanner' engine' (or protocol) that Linux uses is called SANE (abbreviation for Scanner Access Made Easy).
SANE : The scanner program for Linux
SANE is available from http://www.mostang.com/sane or latterly http://sane-project.org. However almost all Linux distributions carry SANE. SANE is a command-line program that provides the communication between the scanner and the computer. Initially only SCSI scanners were supported. But due to excellent corporation by some of the major scanner manufactures such as Epson, Umax etc, many scanners such as the lower cost USB and Firewire types are now well supported. The website above gives list of supported scanners.
SANE can run in the conventional single user mode attached to a single computer. It can also be used over a network. Recently SANE has been extended to analogue TV cards, Camcorders and digital cameras. SANE has two GUI interfaces. On current Linux distributions SANE is generally used with any of the three graphical user interfaces or GUIs:
Xscanimage: This provides basic scanning in Lineart, Haftone, Grey and Colour.Xsane: This provides the scanning modes as above as well as Xsane modes of Copy, Fax and Email . It also provides for scanning from larger range of scanning media. Xsane is the more sophisticated of the two but for quick scans Xscanimage is often adequate.Kooka: This is the new scanner interface developed by KDE. It works in conjunction with SANE. It is also well integrated into the KOffice suite.
Installing a scanner in Linux
If the scanner is attached to the computer at the time of Linux installation SANE and GUI-interfaces (Xsane/Xscanimage and Kooka will be installed). If no scanner is attached these programs might can be installed from binaries when the scanner is first needed. The procedure is to have the scanner on then login in the control centre as root.
Scanner installation in SuSE Linux:
The user opens YAST as root (as shown in figure using-scanner1 then clicks on the Scanner Icon. The dialog shown in figure using-scanner2 is generated.
Figure using-scanner1: Installing a scanner in SuSE Linux- step1.
The test button (on figure using-scanner2 (top)) can be used to generate a test page which replaces the SANE logo. Clicking the Next button generates the dialog shown in figure using-scanner2 (bottom). Clicking the Finish button on this latter dialog completes the setting up process.
Figure using-scanner2: Installing a scanner in SuSE Linux- step2 (top), step3 (bottom)
Scanner installation in Mandrake Linux
In Mandrake Linux, clicking the Scanner icon on the hardware icon in the Mandrake Control Center dialog generates a dialog with a large range of scanners. The attached scanner is usually highlighted.
Figure using-scanner3: Installing a scanner in Mandrake Linux; left- step1; right-step2.
As with SuSE Linux, Installation of the scanner usually deposits a scanner icon on the desktop.
Scanner installation in Redhat/Fedora Linux:
Redhat/Fedora relies on the philosophy that if the scanner interface (i.e. SCSI, USB, Firewre) is detected then the attached device need not have any configuration menu. Consequently there are no scanner configuration menus. The scanning program when launched finds the scanner! This works fine for scanners with modern USB and firewire interfaces. For such scanners once the scanner is identified, all users have access to it. For SCSI scanners however, only the system-administrator has access to the SCSI device so extra configuration (for normal user access is required), This is described later.
Using Xsane
Xsane is usually started by any of the following:
clicking on the scanner desktop icon,
navigation from the start menu usually under ~/graphics/Xsane
or typing xsane in a shell.
The first use of the program usually invokes the dialog shown in figure using-scanner4.
Figure using-scanner4: An example of the dialog invoked on the first use of Xsane.
For scanners with SCSI interface some extra configuration may be needed to allow users other that root to use the scanner. On current versions of Mandrake and SuSE Linux(es) the configuration is done automatically. On current versions of Redhat/Fedora Linux the following is needed:
Under Start/System settings/Users and groups a group called for example 'scanner' is created.
All users are put in this group.
As super-user (in a shell) Xsane can be launched to determine the label of the the SCSI scanner device for example /dev/sg0, or /dev/sga
Suppose the SCSI scanner is seen at /dev/sg0 at shell prompt the following two commands are issued:-
chgrp scanner /dev/sg0 chmod 660 /dev/sg0
Figure using-scanner6 shows how Xsane as it is usually started. Three dialogs are invoked:
In the centre is a dialog showing some optical characteristics of the image. The bottom of the dialog has a set of buttons (labeled on the figure). The second button from the right can be used to toggle the data in the dialog from histogram type to linear graphic type. ( An example of the latter is shown in figure using-scanner9 (a).)
The rightmost dialog is usually the preview window. Here for space it is at the bottom of the figure. (It is also shown here in the process of acquiring a preview image.) A preview is started by pressing the Preview button on this dialog.
Figure using-scanner5: Left -the invoked dialog on the first use of Xsane; right-buttons on the preview dialog.
After the preview is generated, the mouse (with left button down) can be dragged over the previewed area to select the required region for scanning. The memory usage required for the scan with the selected parameters is reported on the dialog to the left of the Start button.
The Xsane drop down menus
The contrast, hue, resolution etc. settings can be made on the main dialog on the left. The main drop-down menus are shown in the next figure.
Figure using scanner7: The X-sane menus: (Left) the File menu; (Centre) the Preferences menu; (Right): the View menu.
Typical results for Setup (from the Preferences menu) and Show advances options (from the View menu) are shown in the next figure.
Figure using-scanner8:
Left typical results of Show advances options (from the View menu)
Right typical results of Setup (from the Preferences menu). Tabs on this dialog are used to set a large number of options for X-sane.
The memory usage required for the scan with the selected parameters is reported on the dialog to the left of the Start button. The scanning session is triggered by pressing the Start button. When the scanning has started the entries on the dialog are grayed-out and the scanning progress is shown to the left of the Cancel button. This is shown in figure using-scanner9.
Figure using-scanner9: Left- Image RGB characteristics shown as linear graph Right- Xsane main dialog showing scanning in progress.
The scanned image is deposited in the viewer. An example of a scanned image in the Xsane viewer is shown in figure using-scanner10.
Figure using-scanner10: An example of a scanned image in the Xsane viewer. The viewer allows
a) saving of the image in various formats such as pnm, png, jeg, bmp etc b) manipulation of the image via the buttons on top of the dialog.
Using Xscanimage
Xscanimage is in effect a stripped-down version of Xsane. It is launched from the graphics/scanning menu or typing xscanimage at command prompt. Two dialogs are generated on launch. These are shown in figure using-scanner11.
Figure using-scanner11: Left - an example of Xscanimage in action; right- he dialog that reports scanning progress in Xscanimage.
A preview is generated by pressing the Preview button.
The required area is selected from the Preview by dragging left mouse down on the preview.
The memory usage is in the box above the Scan button.
The file name is placed in Filename text-box (typical extensions are pnm, jpg mbp etc)
On pressing the Scan button the dialog shown on the right of is generated. It is normally on the top of the main dialog shown on the left of the figure.
Using Kooka:
Kooka is the scanner interface to SANE used by KDE. Kooka is usually accessed using the the main menu start-button under the graphics group of programs. (An example for Fedora Linux is shown in figure kooka1). It can also be started from within programs in the KOffice suite.
Figure kooka1: Left:- the main graphics menu in Fedora Linux showing entry for Kooka. Right:- the first dialog when Kooka is started.
The main Kooka dialog is shown in the next figure. The window on the left shows the images in the Kooka gallery. A previewed scan is shown in the window in the right. The Scanner settings area allow for setting of scan mode, resolution etc. Two buttons at the bottom are used for Preview scan and Final scan.
The Image and Setting menus have a large number of options. (the former is considered later). The reader is encouraged experiment with these, The tool-bar below the main drop-down menus controls settings for printing, ocr (optical character recognition) an image symmetry-manipulation. Again in this brief course these will no be discussed and the reader is encouraged to experiment with these to gain familiarisation.
Figure kooka2 shows Kooka with a scanned preview. The Preview tab allows the generation of a preview scan.
Figure kooka2: An example of a scanned preview in Kooka.
The Kooka dialog is frame-based. Frames ( for example the Kooka-gallery frame) can be completely removed. Scanning is done selecting the scanned area in the previewed (the dotted rectangular area) and pressing the Final Scan button.
Once scanning is complete the Save assistant dialog shown in figure kooka3 is generated. This is for selecting the file format to save the file. An example is dialog shown in th next figure.
A scanned image is automatically saved and a 'thumbnail' image appears at the foot of the dialog. This is shown in the next figure also.
Figure kooka3: Left - the save assistant dialog in Kooka. It is used for selecting the file format to save the scanned image. Right- a scanned image and thumbnail image in Kooka.
The scanned image can be opened in other applications via the Image menu. An example is shown in the next figure. This menu has an entry for the start of the optical-character-recognition (or ocr) for scanned images of words. An example of this startup in progress is also shown in the next figure.
Figure kooka4: Left - the image menu in Kooka that allows (a) the opening other graphic applications (b) OCR and image manipulation; right -an example os starting OCR via the image menu in Kooka.
Configuring Kooka and printing from Kooka
Kooka can be configured from the Settings menu. The generated dialog is shown in the next figure. Kooka is well integrated within the Kde print system. It is therefore easy to print. and/or scan-and-print and emulate the action of a photocopy-machine and with Kprint fax a fax machine. Printing from Kooka generates the Kprinter dialog. This too is shown in the next figure.
Figure kooka5: Left - the dialog for configuring Kooka; right-an instance of the KPrinter dialog called from within Kooka.
Using a scanner from OpenOffice/Linux
The Openoffice/StarOffice have facilities for photo-graphic scanning. Results are variable as earlier versions of OpenOffice appear to have a preference for the Twain protocol found on scanning on Windows-running computers. For our prototype example the scanner is called from the Insert-menu; this is shown in the next figure.
Figure openoffice-scanning1: Step1 in using a scanner in openoffice on Linux: left - navigating the insert menu; right the generated scanner-recognition dialog.
To set-up preview:
The OK button is pressed on the dialog on the right of the last figure.
The Create preview button is clicked.
The Scan mode is set (a drop down menu for setting the dpi forms in the grey area labeled scan Mode).
The Scan area spin-boxes provides geometric settings area to be scanned.
The OK button is clicked.
The settings are saved with the OK button. The above are shown in the next figure.
To scan and insert picture into OpenOffice/Writer the Insert>graphics>Scan>Request is executed (from the drop down menu). The scanned-image is then deposited in the OpenOffice/Writer workspace. This too is shown in the next figure.
Figure openoffice-scanning2: Step2 in using a scanner in openoffice on Linux: Right - the pre-generated preview scan; middle -the open-office document for picture insertion; right- the document with the inserted image.
Scanning from the GIMP
Gimp has a scanner interface from the File-menu. It can be used to open menus for both xsane or xscanimage, It is accessible via the Acquire-entry on the File-menu. The sub-menu is shown in the next figure.
Figure scanning-from-gimp1: The Acquire sub-menu from the Gimp's file-menu.
Scanning from the gimp has the advantage that the scanned image is loaded automatically in Gimp. And from the Gimp a multitide of image-editing facilities are available. For the actual scanning the sections (above) on Xsane and Xscanimage can be consulted for further steps.
Scanning from KOffice
This uses the Kooka interface and is described on the section on KOffice.
For information about Linux resources (books, machines and interface cards) available from Basis Volume please browse the
b-vol website. and click on b-vIT.
This 'how-to' is an excerpt from our introduction-to-Linux course.