Using Scanners in Fedora


With the rise of digital photography, there has been an equal decline in the need for image scanners. However, there are still times that you want to use a scanner; thankfully, Fedora makes it easy.

You can also use many types of image scanners with The GIMP. In the past, the most capable scanners required a SCSI port. Today, however, most scanners work through a USB port. You must have scanner support enabled for Linux (usually through a loaded kernel module, scanner.o) before using a scanner with The GIMP.

Although some scanners can work via the command line, you will enjoy more productive scanning sessions using a graphical interface because image manipulation tasks, such as previewing and cropping, can save time before actually scanning an image. Most scanners in use with Linux use the Scanner Access Now Easy (SANE) package that supports and enables graphical scanning sessions.

SANE consists of two software components. A low-level driver enables the hardware support and is specific to each scanner. Next, a graphical scanner interface X client known as xsane is used as a plug-in or ancillary program (or script) that adds features to The GIMP.

Note

Although xsane is commonly used as a GIMP plug-in, it can also be used as a standalone program. Another useful program is Joerg Schulenburg's gocr client, used for optical character recognition (OCR). Although not a standalone application, it is included in the Kooka scanning application. This program works best with 300 dots per inch (dpi) scans in several different graphics formats. OCR is a resource-intensive task and can require hundreds of megabytes of disk storage!


A list of currently supported scanners can be found at http://www.sane-project.org/sane-supported-devices.html. Unfortunately, if your scanner doesn't appear on the list, you should not expect it to work with the SANE software. There is also a list on that same page for drivers not yet included, but you must be able to compile the application from source to use them.

Supported USB scanners are automatically detected and the appropriate driver is loaded automatically. The USB devices tell the USB system several pieces of information when they are connectedthe most important of which are the vendor ID and the device ID. This identification is used to look up the device in a table and load the appropriate driver.

Many scanners are supported in Linux. If yours is not, it still might be possible to use it. The Kooka and xsane scanner applications are included with Fedora and are fairly straightforward to use. They can both be found in the Graphics menu as the Scanning and Scan & OCR Program menu items.

USB Scanner Success is Elusive

Because a failure is sometimes more educational than a success, for previous editions of this book, we attempted to configure a USB scanner that wasn't supported: the Canon N650U. With the release of the version of SANE included with Fedora, the scanner is now supported, and it is automatically detected!

However, here are the manual steps we used for detecting and configuring this scanner in Linux when it did not work properly:

First, connect the scanner. For this USB scanner, look at the output of

# cat /proc/bus/usb/devices/


(We have truncated the output here to show only the scanner. You can also use the lsusb command.)

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12 MxCh= D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P:  Vendor=04a9 ProdID=2206 Rev= 1.00 S:  Manufacturer=Canon S:  Product=CanoScan C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=ff Driver=(none) E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=16ms E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms E:  Ad=03(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms


Driver=(none) at the end of the seventh line tells us that the device was not found in the lookup table. Because we now have the "magic" vendor ID and device ID, we can attempt to load the driver manually with

# /sbin/modprobe scanner vendor=0x04a9 product=0x2206


Now the output of the catlsusb command from before tells us that the scanner device driver is associated with our scanner:

[View full width]

I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=ff Driver=usbscanner


and the Kooka and Xsane applications now recognize the scanner.


Working with Graphics Formats

Image file formats are developed to serve a specific technical purpose (lossless compression, for example, where the file size is reduced without sacrificing image quality) or to meet a need for a proprietary format for competitive reasons. Many file formats are covered by one or more patents. For example, the GIF format has fallen into disfavor with the open-source crowd because the patent holder has only recently decided to begin enforcing his patent rights.

If you want to view or manipulate an image, you need to identify the file format to choose the right tool for working with the image. The file's extension is your first indicator of the file's format. The graphics image formats supported by the applications included with Red Hat include

  • .bmp Bitmapped graphics, commonly used in Microsoft Windows

  • .cgm Computer graphics metafile

  • .g3 CCITT Group 3 FAX image

  • .gif CompuServe graphics interchange format

  • .ico Microsoft Windows icon image

  • .jpg Joint Photographic Experts Group

  • .mng Multiple-image network graphic image

  • .pbm Portable bitmap file format

  • .pcx IBM Paintbrush

  • .pgm Portable graymap file format

  • .png Portable network graphics

  • .pnm Portable anymap

  • .ppm Portable pixmap file format

  • .rgb Raw red, green, and blue samples

  • .rs Sun raster image

  • .svg Scalable vector graphics

  • .tif Tagged image file format

  • .xbm X bitmap image

  • .xpm X pixmap image, commonly used for Linux icon images

An extensive list of image file extensions can be found in the man page for ImageMagick, an excellent application included with Fedora, which you learn more about in upcoming sections of this chapter.

Tip

Fedora includes dozens of graphics conversion programs, and there are few, if any, graphics file formats that cannot be manipulated when using Linux. These commands can be used in Perl scripts, shell scripts, or command-line pipes to support many types of complex format conversion and image manipulation tasks. See the man pages for the ppm, pbm, pnm, and pgm families of commands. Also see the man page for the convert command, which is part of a suite of extremely capable programs included with the ImageMagick suite.


Often, a file you want to manipulate in some way is in a format that cannot be used by either your graphics application or the final application. The solution is to convert the image filesometimes through several formats. The convert utility from ImageMagick is useful as is the netpbm family of utilities. If it is not already installed, ImageMagick can be installed with the Add Remove Software GUI found in the System Settings menu; the netpbm tools are always installed by default.

The convert utility converts between image formats recognized by ImageMagick. Color depth and size also can be manipulated during the conversion process. You can use ImageMagick to append images, surround them with borders, labels, rotate and shade them, and perform other manipulations well-suited to scripting. Commands associated with ImageMagick include display, animate, identify, and import. The application supports more than 130 different image formatsall listed in the man page for ImageMagick.

Fun with Imagemagick's identify

You can use ImageMagick's identify command to identify details about image files. The welcoming splash image used for the GRUB bootloader is located in /boot/grub and is a gzipped .xpm image. If you run identify on the image, you'll discover that it's a 640x480 xpm image with 16-bit color depth. That's all you need to know to construct a replacement image of your own. Using The GIMP or another graphics tool, crop or resize your chosen image to 640x480 and change the color depth to 16 bits. Save the image as splash.xpm and then gzip the resulting file. Replace the original Red Hat file, and you now have a custom boot image. The use of identify helped you duplicate the parameters of the original image to comply with the requirements of GRUB.

The identify command is useful to identify unknown image files and to determine whether they're corrupt.


The netpbm tools are installed by default because they compose the underpinnings of graphics format manipulation. The man page for each image format lists related conversion utilities; the number of those utilities gives you some indication of the way that format is used and shows how one is built on another:

  • The man page for ppm, the portable pixmap file format, lists 47 conversion utilities related to ppm. This makes sense because ppm, or portable pixmap, is considered the lowest common denominator for color image files. Because of this, it is often used as an intermediate format.

  • The man page for pgm, the portable graymap file format, lists 22 conversion utilities. This makes sense because pgm is the lowest common denominator for grayscale image files.

  • The man page for pnm, the portable anymap file format, lists 31 conversion utilities related to it. However, there is no format associated with pnm because it operates in concert with ppm, pgm, and pbm.

  • An examination of the man page for pbm, the portable bitmap file format, reveals no conversion utilities. It's a monochrome format and serves as the foundation of the other related formats.

Capturing Screen Images

You can use graphics manipulation tools to capture images that are displayed on your computer screen. Although this technique was used for the production of this book, it has broader uses; there is truth to the cliché that a picture is worth a thousand words. Sometimes it is easier to show an example than it is to describe it.

A captured screen image (also called a screen grab or a screenshot) can be used to illustrate an error in the display of an application (a font problem, for example) or an error dialog that is too complex to copy down by hand. You might just want to share an image of your beautifully crafted custom desktop configuration with your friends or illustrate your written documents. In this section, you learn how to capture screen images for these and other purposes.

When using the GNOME desktop, you can take advantage of the built-in screenshot mechanism (gnome-panel-screenshot). Access this tool by pressing the Print Screen key. (Alt+Print Screen takes a screenshot of only the window that has focus on a desktop.) Captured images are saved in .png format.

You also can capture screen images from a remote computer using tools supported by Fedora. The import command (one of ImageMagick's commands) was used to take the screenshots for this book; for example, using a local computer and a remote computer on a LAN.

First, we ran $ xhost + on the remote computer to allow another computer access to the X server on the remote machine; the command to take the screenshot is run on our local machine like this:

$ import -window root -display 192.168.2.4:0 12fig07.jpg


This utility made a difficult task easy because the publisher required the screenshots be done from an 800x600 screen (too small to comfortably work in) to accommodate its printing and production equipment.

We could also have used the classic UNIX tool xwd to take screenshots. The command would have looked similar to that of import:

$ xwd -root -display 192.168.2.4:0 -out 12fig07.jpg


Although the screenshots could have been taken with The GIMP and saved in the appropriate format, we would have had to run The GIMP on that computer and navigate the menus every time we captured an imagethe remote option of import was very convenient.

We did not use Ksnapshot (not included in the menus, but available from the command line) because it does not support the .pcx format the publisher used to use and it must be run locally. However, it can take screenshots easily and is our preferred tool for use on a single machine.

Relevant Fedora Commands

These are the commands you use when working with graphics applications for Fedora:

Cameras

gtkam A front end for gPhoto2

kamera The KDE digital camera utility

dvgrab A video camera capture utility using a FireWire connection

Scanners

kooka The KDE scanner application

xsane A scanner application

Graphics

eog Eye of GNOME image viewer

ImageMagick An image manipulation application

gimp The GNU Image Manipulation Program

gqview GNOME image viewer

kcoloredit KDE palette editor

kiconedit KDE icon editor

kpaint A graphics application

kuickshow KDE image-viewing application

kview KDE embedded image viewer

ntpbm-progs Tools for manipulating netpbm-formatted graphics

xfig A vector graphic application




Red Hat Fedora 5 Unleashed
Red Hat Fedora 5 Unleashed
ISBN: 067232847X
EAN: 2147483647
Year: 2004
Pages: 362

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net