Graphics Manipulation

 < Day Day Up > 

If you have ever wished you could change a photograph slightly red eyes returned to their normal color, dark areas lightened, funny Uncle Bert removed and longed for a way to accomplish that task, you have been granted your wish. Now, you can accomplish all of these tasks with the tools provided with Fedora (and a digital image from a digital camera or from a scanner).

This section of the chapter discusses The GIMP, a powerful graphics manipulation tool. (You learned about the other graphics tools that Fedora provides in Chapter 9.) In this section of the chapter, you also learn about graphic file formats supported by Fedora, as well as some tools you can use to convert them if the application you want to use requires a different format.

The GNU Image Manipulation Program

One of the best graphics clients is The GIMP. The GIMP is a free, GPLed image editor with sophisticated capabilities that can import and export more than 30 different graphics formats, including files created with Adobe Photoshop. It is often compared with Photoshop, and The GIMP represents one of the GNU Projects' first significant successes. You will see many images in Linux that have been prepared with The GIMP.

The GIMP can be started by clicking a desktop panel menu item or by using the command line, like this:

 $ gimp & 

You will see an installation dialog box when The GIMP is started for the first time, and then a series of dialog boxes that display information regarding the creation and contents of a local GIMP directory. This directory can contain personal settings, preferences, external application resource files, temporary files, and symbolic links to external software tools used by the editor.

What Does Photoshop Have That Isn't in The GIMP?

Although The GIMP is powerful, it does lack two features Adobe Photoshop offers that are important to some graphics professionals.

The first of these is the ability to generate color separations for commercial press printers (CMYK for the cyan, magenta, yellow, key, or black colors). The GIMP uses RGB (red, green, and blue) which is great for video display, not so great for printing presses. The second feature GIMP lacks is the use of Pantone colors (a patented color specification) to ensure accurate color matching.

If these features are unimportant to you, The GIMP is an excellent tool. If you must use Adobe Photoshop, the current version of Codeweaver's Crossover Office will run Photoshop in Linux.

These deficiencies might not last long. A CMYK plugin is in the works, and the Pantone issues will likely be addressed in the near future as well.


After the initial configuration has finished, The GIMP's main windows and toolboxes appear. The GIMP's main window contains tools used for selection, drawing, movement, view enlargement or reduction, airbrushing, painting, smudging, copying, filling, and color selection. Depending on the version installed on your system, the toolbox can host more than 25 different tools.

The toolbox's File, Xtns, and Help menus are used for file operations (including the ability to send the current image by electronic mail), image acquisition or manipulation, and documentation, respectively. If you right-click an open image window, you'll see the wealth of The GIMP's menus, as shown in Figure 10.5.

Figure 10.5. Right-click on an image window to access The GIMP's cascading menus.


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 in order 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 icons 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 manual 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 are 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 formats (all 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 Red Hat Linux. 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 800 x 600 screen (too small to comfortably work in) to accommodate their 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 be running The GIMP on that computer and navigating the menus every time we captured an image the 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, but it can take screenshots easily and is our preferred tool for use on a single machine.

Enabling Java

Some multimedia content relies on Sun's Java and Java web browser plug-ins.

Getting the Java plug-in to work correctly with the Mozilla browser can be a challenge. Download the latest version (versions prior to 1.4.1 will not work) from http://java.sun.com/. (You can find a modified .rpm version of the files at http://dag.wieers.com/packages/j2re/.) As root, make the downloaded file executable with chmod +x and unpack it with ./j2re-1_4_2_05linux-i586-rpm.bin; install the resulting rpm file with

 # rpm ivh j2re-1_4_2_05 -linux-i586.rpm 

To make the Java plug-in work with Mozilla, you need to link it correctly:

# ln -s /usr/java/j2re1.4.2_05/plugin/i386/ns610-gcc32 /libjavaplugin_oji.so/usr/lib/mozilla/plugins/

You might also need to link the Java binary into /usr/bin:

 # ln -s /usr/java/j2re1.4.2_05/bin/java /usr/bin/java 

Java can be difficult to install properly because of PATH problems. Here's a way to do it correctly:

Edit your /etc/profile file to add the following lines. This will inform the system where the Java executable is found.

 JAVA_HOME=/usr/java/j2re1.4.2_05 PATH=/usr/java/j2re1.4.2_05/bin:$PATH 

You can also find numerous multimedia goodies at http://freshrpms.net/ and at http://www.cs.trinity.edu/ftp/pub/FC2-Software-Additions//. The multimedia applications that used to be part of Fedora before its merger with Red Hat are now housed at http://rpm.livna.org. To add this repository to YUM, add to /etc/yum.conf the lines

 [livna-stable] name=Livna.org Fedora Compatible Packages (stable) baseurl=   http://rpm.livna.org/fedora/$releasever/$basearch/yum/stable gpgcheck=1 

and for APT, add this line to /etc/apt/sources:

 rpm http://rpm.livna.org/ fedora/1/i386 stable 

and for Up2date,

 yum livna-stable  http://rpm.livna.org/fedora/1/i386/yum/stable 

Add the GPG key as detailed on the Livna home page. See Chapter 7 for details on using these package management tools.


Relevant Fedora Core Linux Commands

You will use these commands when working with multimedia applications for Fedora Core Linux:

CD/DVD Disks

cdda2wav Copies WAV files from CDs; used by other applications

cdlabelgen Creates labels for CD jewel cases; used in scripts

cdp A text-mode CD player

cdparanoia A CD ripper

cdrecord A command-line tool to record CDs

dvd+rw-tools A command-line tool to create DVDs

grip A CD music ripper

mkisofs Creates ISO files

xcdroast A CD recorder

Sound and Music

alsamixer A console audio mixer

kmid A MIDI player

mikmod A MOD music player

rhythmbox The default music player; it can play from playlists or Internet radio stations

sox A sound conversion tool

sound-juicer A CD ripping tool

system-config-soundcard Default sound card configuration utility

vorbis-tools The OGG Vorbis codecs

xmms An MP3 player

Video

kaboodle A KDE media player

noatun KDE media player

tvtime A television viewer

xine A video player

xmms An MPEG1/2/3 player

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


     < Day Day Up > 


    Red Hat Fedora 4 Unleashed
    Red Hat Fedora 4 Unleashed
    ISBN: 0672327929
    EAN: 2147483647
    Year: 2006
    Pages: 361

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