Scanning . . .

There are many scanner options available, from old-fashioned parallel port devices to SCSI-connected scanners. These days, most people will choose a USB scanner for its low price and easy connection to the system. As with all devices, a visit to the USB devices for Linux Web site will save you time (and money) by helping you select a device that is well suited to run under Linux. If your scanner was connected to your system when you installed Linux, parts of the following section may not apply since your system may have already configured your scanner for you. Still, you should follow along to understand how all this happens.

Start by plugging in your scanner and, if necessary, turning it on (some scanners are on as soon as you plug them in). Any recent Linux distribution should do a very nice job of automatically noticing your scanner and loading the appropriate driver. Depending on your system, your USB scanner will be represented by the file name /dev/scanner0 or /dev/usb/scanner0. You may want to check for the existence of this file: Open a shell and type the following:

ls -l /dev/scanner0
ls -l /dev/usb/scanner0

Another way to check for the existence of your scanner is to use the following command:


You'll get several lines of text and information. In particular, you are looking for those lines that begin with the word found.

found USB scanner (vendor=0x04b8, product=0x0110) at /dev/usb/scanner0

Before you can use your USB scanner, you may have to do a little setup work. Luckily, this is pretty simple, and you only have to do it once. For starters, it is possible that you may have to create the device file for your scanner manually. If the file isn't there, open a shell and switch to the root user.

su - root

Then use the following commands to create the USB scanner device file and make it usable by all users.

mknod /dev/usbscanner0 c 180 48
chmod 666 /dev/usbscanner0

You are almost there. Still running as root, change directory to /etc/sane.d and do an ls in that directory. You'll see a number of files ending in .conf, prefixed by a scanner brand name. In the case of my Epson scanner, I had to edit the /etc/sane.d/epson.conf file and change the following line.

#usb /dev/usb/scanner0

That "#" character at the beginning denotes a comment. Removing that character makes the line real (Figure 16-3). If you don't want to have to learn to use a programmer's editor, KDE has a very simple one that you can use. It is called Kedit, and you can run it from your current root shell by typing kedit. When the editor starts, click File on the menu bar, and select Open File. You've seen this open file dialog before, so this is nothing new now. If you know which model file you need, just type it in the Location: field and press <Enter>. Otherwise, you can navigate your folders just as you would in Konqueror.

Figure 16-3. Using kedit to edit the scanner model file.


Make the changes as discussed above (Figure 16-3). Remove the comment character from the line that corresponds to your scanner device, then click File | Save, then File once again, followed by Quit, and you are done. It isn't necessary to reboot to get this new service running. Just load up the scanner module:

modprobe scanner

Type exit to leave the root shell, then exit again to close Konsole.

Scanning under KDE?Kooka

A number of scanning programs exist for Linux, and most are front ends to a package called SANE (Scanner Access Now Easy). One such front end is included with your Linux system. Kooka, part of KDE, is one such program.

Kooka is both a scan and optical character recognition (OCR) program. What this means is that you can use it to scan a document of text and export that text back into a word processing package of some sort for further editing.

You'll find Kooka under the main Multimedia or Graphics menu but you can also start the program from the shell or with your quicklauncher <Alt+F2>. The actual program name is kooka. When you start the program, you will see a dialog box similar to that in Figure 16-4. Kooka looks for available scanners and offers you a choice. If you have only one scanner on your system (as is usually the case), check the box labeled Do not ask on startup again, always use this device before clicking OK.

Figure 16-4. Kooka autodetects your connected scanner.


Once past this point, Kooka's main window will appear (Figure 16-5). It consists primarily of three areas, or frames: two horizontal frames to the left consisting of a navigation window up top and a Scanner Setting window at the bottom. The large right-hand side is the scan window itself. Along the top, you'll see a familiar-looking menu and icon bar. You can resize the main window to suit your tastes (and monitor size), as well as the individual frames.

Figure 16-5. Kooka's main screen and work area.


Let's start by having a look at the navigation window. There are two tabs here, one labeled Gallery and the other Preview. Ignore the Preview tab for now and click on the Gallery tab. Now look directly beneath those tabs. You'll see a directory and file browser with a default directory called Kooka Gallery. You can create additional folders below this by right-clicking on the directory and selecting Create directory. As with all such dialogs, you can create directories inside of directories to organize your files efficiently. Scanned files will be saved in these directories.

Before scanning your first image, look down at the bottom left-hand window, where your scanner settings are set. What you see there will vary, depending on the model and type of scanner you are running. On my system, I used an Epson GT-8200. You can adjust scan mode (black and white, grayscale, or color), as well as resolution. Keep in mind that although higher resolution generally means higher quality, it also means a much larger file in terms of storage space. For Web page purposes, 75?100 dpi is probably ideal.

On my scanner, I can also adjust the brightness, sharpness, and gamma correction. The correct settings are somewhat of a trial-and-error affair. More than one scan may be necessary to decide what works (and looks) best.



These settings are scanner-specific, and different scanners may have different settings.

Find a photograph or picture you like, and put it on the scanner. Click the Preview Scan button in the Scanner Settings window. After the scan is complete, you can preview the results by clicking on the Preview tab in the top left-hand window.

In the image preview window, you can select the scan size to define the actual dimensions of the scanned file. If you want only a small portion of the photo, you can also drag the dotted lines in the preview window (with the mouse) to encompass only the part you wish to save. When you are happy with the preview, click Final Scan in the settings window.

When the scan is complete, the Kooka Save Assistant will appear (Figure 16-6). The various image formats available will be displayed, along with a description to help you make a decision on whether this is the format you wish to use. For instance, JPEG is described as "high compression, quality losing format for color pictures with many different colors." If you are always saving in the same format, you can elect to click the check box labeled Don't ask again for the save format if it is defined. Should you change your mind, click Settings on the menu bar, and select Configure Kooka. Under Image Saving, you can elect to bring back the Save Assistant.

Figure 16-6. The Save Assistant helps you choose the file format.


Once you click OK, your scanned picture will appear in the scan window to the right (Figure 16-7). View options, such as Scale to width, Set zoom, or Rotate image clockwise, can be selected by right-clicking on the image. Switch back to the Gallery view by clicking the tab on the right side, and scanned images will appear with sequentially assigned names.

Figure 16-7. The final scan.


Saving Your Work

In a strange way, your images are already saved. In your home directory, you'll find another directory called .kde, where your KDE configuration files, Kmail address books, Konqueror bookmarks, and other files live. As it turns out, your scanned images are already saved there, although technically, they are still work files. If you want to have a look, check out .kde/share/apps/ScanImages in your home directory. If you created new directories in your Gallery, you'll see them as well.

To officially save your work in Kooka, right-click on one of your scanned images in the Gallery frame (top left), and select Save Image. You'll be presented with the standard KDE save dialog. Choose a directory and a name for your image, and click Save (Figure 16-8).

Figure 16-8. Now it is time to save your images.


You can now take that image, fire up the GIMP, and modify it at will.

The GIMP? I'll cover that very soon. I still have a little scanning magic to share with you.