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 if you use a graphical interface because GUI features, 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 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.
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 connected — the 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.
You will find that Fedora successfully identifies and configures most modern USB-based scanners.
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 straight forward to use. They can both be found in the Graphics menu as the Scanner Tool.
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 had fallen into disfavor with the open-source crowd because the patent holder waited a while before deciding to enforce his patent rights.
If you want to view or manipulate an image, you need to identify the file format to choose the proper 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 Fedora include the following:
> .bmp
— Bitmapped graphics, commonly used in Microsoft Windows
> .gif
— CompuServe Graphics Interchange Format
> .jpg
— Joint Photographic Experts Group
> .pcx
— IBM Paintbrush
> .png
— Portable Network Graphics
> .svg
— Scalable Vector Graphics
> .tif
— Tagged Image File format
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.
Fedora includes dozens of graphics conversion programs that are accessible through the command line, and there are few, if any, graphics file formats that cannot be manipulated when using Linux. These programs can be called 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 file — sometimes 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, add 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 formats (all listed in the man page for ImageMagick).
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 640?480 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 640?480 and change the color depth to 16 bits. Save the image as splash.xpm
and then gzip
the resulting file. Replace the original Fedora 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 also 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
> 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.