Saturday, November 29, 2008

Manipulating Images with the GIMP

10.2. Manipulating Images with the GIMP

The GNU Image Manipulation Program (GIMP) is a powerful tool that can be used to create, alter, manipulate, and enhance digital image files  -- photographs, scanned images, computer-generated images, and more. This section offers a quick overview of the GIMP and refers you to comprehensive references for learning more about it.

 

10.2.1. GIMP Basics

To use the GIMP, you will need to know some of the basics. From a shell prompt, you start the GIMP using the command gimp. Start the GIMP from the desktop panel by choosing Main Menu => Graphics => The GIMP.

Figure 10-8 shows a typical GIMP session in action.

 

Figure 10-8. The GIMP in Action

 

10.2.2. Loading a File

To load an existing file, click on File => Open. You will see the Load Image dialog, as shown in Figure 10-9.

 

Figure 10-9. The Load Image Dialog

 

The Load Image dialog displays your working directory  -- the directory you were in when the GIMP was launched. You can navigate up and down the file system tree by double-clicking on the Directories list on the left, then selecting a file to open from the Files list on the right. File name completion is supported by the GIMP. If you type the first letter (or more) of a file name into the Selection field and press the [Tab] key, the view will change to only those subdirectories and/or files beginning with that letter or letters.

 

The file you select will appear in the Selection field near the bottom of the dialog. A thumbnail preview will be displayed on the dialog; alternatively, you will see a Generate Preview button. If you want to see a thumbnail of the image, click on the Generate Preview button. Once you have selected a file, click on the OK button to open it. You can also double-click on a file name to open it.

 

10.2.3. Saving a File

To save an image file, right click on the image and choose File => Save (or Save as). You will see the Save Image dialog if you choose Save as or if you choose Save and the file has not been saved before. The Save Image dialog looks almost exactly like the Load Image dialog and navigation of the file system tree and choosing files works in the same way.

 

When you are saving an image, you will need to choose an image format. The GIMP supports a wide variety of image formats, including .gif, .png, .jpg, and .bmp.

 

10.2.4. GIMP Options

Like many applications, the GIMP provides more than one method to accomplish tasks. The easiest way to work with images is to right-click the image, which will display a set of menus containing most of the GIMP's many capabilities, including image sizing, rotation, and filter application.

 

For example, imagine you have a picture that you would like to modify to make it look as if it were clipped from a newspaper. To do this, right-click on the image and select Filters => Distorts => Newsprint.... Select the quantity of lines per inch using the sliders. When you reach a desired quantity and are ready to render the image, click OK. The GIMP will then render the image with the new effect applied. Figure 10-10 shows an example of an image after the Newsprint filter has been applied:

 

Figure 10-10. An Image modified with a GIMP Filter

 

The Toolbox also has several easily accessible functions. Using the Toolbox, you can add text to mages, erase regions of an image, or even fill selected regions with the color of your choice.

 

For example, if you wish to add text to a file, select the button and click on your image. This will load the Text Tool dialog box, where you can choose a font and type some text in the provided text box. Click OK and your text will be displayed in as a floating section on the image. You can then move the text to the position you wish using the Move Layers tool. Figure 10-11 shows our photo with exciting new text:

 

Figure 10-11. Using the Text Tool on an Image

 

As you can see, the GIMP is a powerful imaging tool, and it takes some time to master all of the functions. Try exploring some of the options yourself. If you make a mistake, do not worry. You can always undo your mistakes by right-clicking on the image and choosing Edit => Undo.

 

10.3. Additional Resources

While this chapter covers several applications briefly, there is so much more you can do with them. Refer to the following resources if you are interested in learning more about the applications in this chapter.

 

10.3.1. Installed Documentation

Some applications discussed have online documentation included with the package, accessible right from your PC.

 

Ø      For more information about using GQview, refer to the documentation in

      /usr/share/doc/gqview-<version-number> EADME (where <version-number>

      is the version of GQview installed on your system).

Ø      The GIMP manual page contains some of the more advanced command-line options and environment   variables associated with it. You can read the manual page by typing man gimp at a shell or terminal prompt.

 

10.3.2. Useful Websites

The Web has several sites of interest if you are looking for more detailed information about an application covered in this chapter:

 

Ø      http://gqview.sourceforge.net  -- The official GQview home page.

Ø      http://www.gimp.org/  -- The official GIMP website.

Ø      http://www.rru.com/~meo/gimp/faq-user.html  -- A Frequently Asked Questions (FAQ) list for questions commonly asked about the GIMP by GIMP users (as opposed to developers).

Ø      http://manual.gimp.org/manual/  -- The GIMP User Manual website.

Ø      http://gimp-savvy.com/  -- The companion website to the tutor Grokking the GIMP, by Carey Bunks. The entire tutor is also available on the site for download!

Ø      http://tigert.gimp.org/gimp/  -- The GIMP website of tigert (Tuomas Kuosmanen).

 

10.3.3. Related Tutors

If you need in-depth information about the many capabilities of the GIMP, try your favorite tutorstore.

 

The following tutors were available at the time of this writing:

 

Ø      The Artists' Guide to the GIMP by Michael J. Hammel; Frank Kasper and Associates, Inc.

Ø      GIMP Essential Reference by Alex Harford; New Riders Publishing

Ø      GIMP for Linux Bible by Stephanie Cottrell Bryant, et al; Hungry Minds, Inc.

Ø      GIMP: The Official Handtutor by Karin Kylander and Olof S. Kylander; Coriolis Group

Ø      Grokking the GIMP by Carey Bunks; New Riders Publishing

Ø      Sams Teach Yourself GIMP in 24 Hours by Joshua and Ramona Pruitt; Sams

Working with Images

Working with Images

There are several types of image files. Some images are created using sophisticated software packages, while others are made from digital cameras and scanners. You may have downloaded some of these image files from the Internet or received them in an email. You may also want to create your own images to send to others. You can view and manipulate the most common types of image files using the many applications included in Red Hat Linux.

 

10.1. Viewing Images

This section discusses some of the common tools for viewing image files. Certain tools available are specialized applications with several functions that enhance your image viewing experience; while others are general-purpose browsers that have some image viewing functionality.

 

10.1.1. Using Nautilus to view Images

Nautilus is a general-purpose file manager and browser for your desktop environment. Nautilus has many functions beyond simple image viewing; however, for this section, we will use it for basic image browsing. For more information about Nautilus, see Chapter 1. Nautilus is known for its ease-of-use, and it handles images with the same ease as it does for other file types.

 

To begin browsing your image collection with Nautilus, double-click on your home desktop icon: You will be presented with a view of all the files and folders within your home directory. Double-click the image (or folder containing the image) and Nautilus will open the new file or folder within its browser window. Figure 10-1 shows that Nautilus automatically creates thumbnails of any images in your folders:

 

Figure 10-1. Contents of a Folder in Nautilus

 

Double-click on any thumbnail icon to view the image in its native size. The image will load within the browser window, along with a thumbnail view and detailed file information along the left panel.

 

Below the file information are advanced options for working with the file. By default, Nautilus offers you the option of opening the file with Eye of Gnome, a robust image viewer with more advanced imaging features than Nautilus.

 

To increase and decrease the size of the viewed image in Nautilus, click on the magnifying glass icon on the location bar as shown in Figure 10-2:

 

Figure 10-2. The Zoom Function in Nautilus

 

Click the + icon to increase the size of the image or - to decrease it.

 

10.1.2. Using Konqueror to View Images

You can also use the Konqueror file manager to view images. If you chose KDE as your default desktop environment, click on your home directory desktop icon to access the Konqueror file manager:

 

Using Konqueror as an image browser works similarly to Nautilus. To configure Konqueror to view image files within a folder as automatically-generated thumbnail icons, choose View => Preview => Images. When you click on a thumbnail icon, the browser displays the image in its native size, as shown in Figure 10-3.

 

Figure 10-3. Viewing an Image in Konqueror

 

To zoom in and out of an image within Konqueror, you first need to change the way it renders the image. From the top toolbar, choose View => View Mode => KView. This will re-display the image and allow for zooming in and out using the two magnifying glass icons on the toolbar, as shown in Figure 10-4.

 

Figure 10-4. Zooming Buttons in the Konqueror Toolbar

 

You can also open the image with more advanced image viewers, as well as with the GIMP. Rightclick on the image, choose Open With..., then Other.... A pop-up menu will appear allowing you to open the application you wish to use. To launch the GIMP, choose Graphics and scroll down the list of applications. Click on the GIMP icon and click OK, as seen in Figure 10-5.

 

Figure 10-5. The OpenWith... Dialog Box

 

10.1.3. Using GQview

GQview is a powerful image viewer for GNOME desktop users that supports several image file formats, including:

 

Ø      JPG/JPEG

Ø      GIF

Ø      PGM

Ø      XPM

Ø      PNG

Ø      PCX

Ø      TIF/TIFF

Ø      PPM

Ø      BMP

 

GQview is useful for viewing individual image files as well as browsing collections of files in folders.

 

It supports zoom in and zoom out functions, as well as thumbnail views of all image files within a directory. It also supports several advanced options not found in the simple image viewers listed above.

 

GQview can be started from your desktop panel. Choose Main Menu => Graphics => GQview to start the application. If you are at a shell or terminal prompt, start the application by typing gqview.

 

Upon start-up, GQview will browse your user home directory by default. If you have any images in this directory, the gallery panel will automatically generate thumbnails for you to highlight and view in the main display area.

 

Figure 10-6. GQview Displaying a .jpg Image

 

The interface of GQview is straightforward. The toolbar allows you to fit the image to the display window, zoom in and out and toggle between thumbnail view and text-only browser panels. It also has a text field for you to enter a particular path to your image directories. Right-clicking on an image in the display area opens a pop-up menu of image size and other file options such as renaming, moving,copying. You can also hide and unhide the thumbnail file panel and toggle windowed and fullscreen modes within the pop-up menu.

 

You can also combine functions within GQview and create a dynamic presentation effect for groups of images within a directory. In the text field below the toolbar, type the path to the the directory where your images are located and highlight the first image in the thumbnail file list panel on the left. Now press [V] then [S], and you will start a full-screen slideshow where GQview displays images against a black background over your entire desktop. By default, each image in the slideshow is presented for 15 seconds.

 

You can stop and resume the slideshow at any time by pressing [S]. When the slideshow ends, press [V] to exit full-screen mode. GQview can also be used to change your desktop wallpaper quickly and easily. Right-click on the image and choose Edit => Set as wallpaper. From the Edit menu, you can also choose to open the file with a number of image editing utilities, including the GIMP, Xview, and Xpaint. GQview also allows you to customize several settings by clicking the Configure button:

 

The configuration pop-up menu allows advanced users to configure several options. You can customize a directory on startup, change thumbnail sizes, and even change the default image editors to manipulate the file if you would like to use one that is not listed.

 

Figure 10-7. The GQview Options Dialog Box

Audio, Video, and General Amusement

Audio, Video, and General Amusement

This chapter presents you with the lighter side of Red Hat Linux. From games and toys to audio and video applications, Red Hat Linux provides many packages to let you have some fun with your computer.

 

9.1. Playing CDs

To play an audio CD, place the CD in your CD-ROM drive and click Main Menu => Sound & Video => CD Player to open the CD Player application.

 

Figure 9-1. CD Player Interface

 

The CD Player interface acts like a standard CD player, with play, pause, and stop functions. There is also a sliding bar that allows you to adjust the volume. You can press the Next track and Previous Track buttons to skip forward or backward one track; you may also use the Track List drop down menu to choose a track from the available menu.

 

You can edit the track listings for your CDs by clicking the Open track editor button. You can also change the way the utility functions by clicking on the Open Preferences button. Here you can set themes for the player as well as set the behavior of the CD-ROM drive when you open or quit the CD Player application.

 

Figure 9-2. CD Player Preferences

 

9.2. Playing Digital Music Files

Digital audio has become very popular in recent years. Users enjoy the technology because the sound quality is excellent compared to analog tape or records and the files are compact, so an audio file can easily be transferred across the Internet. To allow you to take advantage of this technology, Red Hat Linux includes the powerful X Multimedia System (XMMS), a cross-platform multimedia player that allows you to play several digital music file formats.

 

Figure 9-3. XMMS Interface

 

XMMS can be used for more than just playing digital audio files. By default XMMS can play Ogg Vorbis, RIFF wave, and most module formats. XMMS can be extended through plugins to play a number of other digital multimedia formats.

 

To launch XMMS, go to Main Menu => Sound & Video => XMMS.

To launch XMMS from a shell prompt, type the command xmms.

 

9.2.1. Using XMMS

To play an audio file with XMMS, click the Open button and choose a file from the Load File(s) window.

 

Figure 9-4. The Load File(s) Window

 

In Figure 9-4, you see that there are several files to choose from. The files that end in .ogg are Ogg Vorbis files, a popular new audio file format; the .pls file is an audio playlist file. You can use XMMS to add audio files into a list and then save it as a playlist. This can be convenient if you have several audio files and you want to categorize them (for example, by genre or artist). Highlight the file you wish to play (if you have more than one, you can click and hold the mouse button and drag it over all of the files you want to open) and click OK. Notice that XMMS begins to play your audio files immediately. To adjust the volume click the volume slider (the long slider above the Open button) to the left to lower the volume, and to the right to increase it. There are also buttons to stop, pause, and

skip (backward and forward) your music.

 

There is so much more you can do with XMMS. To learn more about using XMMS, refer to the man page by typing man xmms at a shell prompt.

 

9.3. Troubleshooting Your Sound Card

If, for some reason, you do not hear sound and know that you do have a sound card installed, you can run the Sound Card Configuration Tool utility.

 

To use the Sound Card Configuration Tool, choose Main Menu => System Settings => Soundcard Detection. A small text box will pop up prompting you for your root password.

 

Note

Most sound cards are supported by Red Hat Linux, but there are some sound cards that are not completely compatible or may not work at all. If you are having trouble configuring your sound card, check the Hardware Compatibility List at http://hardware. redhat.com to see if your card is supported.

 

The Sound Card Configuration Tool utility probes your system for sound cards. If the utility detects a plug and play sound card, it will automatically try to configure the correct settings for your card.

 

You can then click the Play test sound button to play a sound sample. If you can hear the sample, select OK and your sound card configuration is complete.

 

Figure 9-5. Sound Card Configuration Tool

 

9.3.1. If Sound Card Configuration Tool Does Not Work

If the Sound Card Configuration Tool does not work (if the sample does not play and you still do not have audio sounds), there are alternatives, although they are not quite as simple as running the Sound Card Configuration Tool. You can edit your modules.conf file as discussed below (this strategy is not recommended for most new users), or refer to the documentation that came with your sound card for more information.

 

9.3.1.1. Manual Sound Card Configuration

If your sound card is not a plug and play card, you can manually edit your /etc/modules.conf file to include the sound card module that it should use,

 

for example:

alias sound sb

alias midi opl3

options opl3 io=0x388

options sb io=0x220 irq=7 dma=0,1 mpu_io=0x300

 

9.4. Troubleshooting Your Video Card

Video card configuration is handled during the Red Hat Linux installation (see the Official Red Hat Linux Installation Guide). However, if you did not choose to configure a video card at that time, or if you need to reconfigure your settings, you can use the X Configuration Tool utility. You will want to do this, for example, if you install a new video card.  

 

Note

The X Configuration Tool will backup your system's original video configuration file to /etc/X11/XF86Config.backup in case you need it to switch back.

 

To run the X Configuration Tool, click Main Menu => System Settings => Display. A pop-up window will prompt you for your root password. You can also start from a shell prompt by typing the command redhat-config-xfree86, which will then prompt you to input your root password. If you are working from a shell prompt and X is not working, redhat-config-xfree86 will attempt to start a minimal X session to allow you to continue your configuration. Follow the instructions that appear on the screen. X Configuration Tool will attempt to automatically configure your video card and monitor settings for you. Figure 9-6 shows the Advanced tab for configuring your video devices manually.

 

Figure 9-6. X Configuration Tool

 

To configure your monitor manually, click the Advanced tab, then click the Configure... button next to the Monitor Type entry. A pop-up window will display a list of monitor models. Choose your model and click OK. You can also let X Configuration Tool probe your monitor for the correct model and vertical/horizontal frequency settings.

 

To configure your video card manually, click the Advanced tab, then click the Configure... button next to the Video Card entry. A pop-up window will display a list of video card models. Choose your model and click OK. You can also let X Configuration Tool probe your video card for the correct model and settings by clicking the Probe Videocard button. When you have finished reconfiguring your video card and monitor, you should be able to start an X session and enjoy your graphical desktop environment.

 

9.5. Games

Playing games under Red Hat Linux is a fun way to pass the time. The games included in Red Hat Linux appeal to quite a large number of video game enthusiasts. Whether you enjoy card games like Aisle Riot (a solitaire card game), arcade games like Tux Racer, board games like Chess, or space shooting games like Chromium and Maelstrom, you can find it in Red Hat Linux.

 

To start a game, click Main Menu => Games and select the game of your choice. Figure 9-7 shows a fun game for kids of all ages called Same Gnome. In this game you point your mouse at matching marbles until they start to spin; then, you can click them to make them disappear. Try to make all the marbles disappear.

 

Figure 9-7. Same Gnome  -- Match the Marbles Game

 

9.6. Finding Games Online

There are many more games available within Red Hat Linux and online. For more information, here are a few suggestions:

 

You can also browse the Internet for linux games using a search engine, such as http://www.google.com.

Working with Documents Cont..

8.1.4. OpenOffice.org Impress

Visual aids can give your presentations an added impact that catches your audience's attention and keeps them interested. OpenOffice.org Impress is a graphical tool that can help you make a more convincing presentation.

 

To start OpenOffice.org Impress from the desktop panel, select Main Menu => Office => OpenOffice.org Impress. To start OpenOffice.org Impress from a shell prompt, type ooimpress.

 

OpenOffice.org Impress features several AutoPilot features that allow you to create presentations from a collection of style templates. You can make slides with itemized lists, outlines, or images. You can even import charts and graphs from OpenOffice.org Calc into a slide.

Figure 8-5 shows OpenOffice.org Impress in action.

 

Figure 8-5. OpenOffice.org Impress

 

When you first start OpenOffice.org Impress, you will be presented with a presentation setup screen, which will prompt you for basic information about what type of presentation you want to make. You can choose the style of your slides, the medium with which you will present your slides (plain paper, transparent paper for overhead projectors, slides, or a display monitor), and any visual effects you want to apply to the slides during presentations from your computer.

 

Figure 8-6. OpenOffice.org Impress AutoPilot Wizard

 

Once you have chosen your preferences with AutoPilot tool, you can choose the type of slide you want to create. You can select a pre-formatted slide from the list or start with a blank slide and customize the layout yourself. To create new slides for your presentation, click Insert Slide... in the floating toolbar, and a pop-up window will appear allowing you to choose the layout of the new slide. You can have as many slides in your presentation as you need.

 

You can also preview your presentation at any point by selecting Slide Show => Slide Show from the pull-down menu. The presentation will be in full screen, which you can exit by cycling through every slide until you reach the end or by pressing the [Esc] key at any point in the slide show.

 

Your presentation can be saved in several file formats. You can save in the native OpenOffice.org Impress format (for example, mypresentation.sxi), the Microsoft PowerPoint format (mypresentation.ppt), or StarImpress format (mypresentation.sdd). You can also print your presentation to plain or transparent paper formats by clicking File => Print from the file menu.

 

To learn more about OpenOffice.org Impress, click Help => Contents form the file menu for the help browser.

 

8.1.5. OpenOffice.org Draw

If you would like to create graphics to include in your documents and presentations, you can use OpenOffice.org Draw. Using your mouse as a you would a pen or a paintbrush, OpenOffice.org Draw allows you to make illustrations and save them in several formats that you can add to printed documents, place on websites, or attach to an email.

 

To start OpenOffice.org Draw from the desktop panel, click Main Menu => Office => OpenOffice.org Draw. To start OpenOffice.org Draw from a shell

prompt, type oodraw.

Figure 8-7 Shows OpenOffice.org Draw in action.

 

Figure 8-7. OpenOffice.org Draw

 

If you are familiar with illustration and graphics applications such as The GIMP (refer to Chapter 10 for more information), you will find that OpenOffice.org Draw has some of the same basic functions. There are toolbars for creating straight and curved lines, basic shapes such as squares and circles, 3D-objects such as cones and cubes, and more. You can create images and fill them with the color of your choice using the Area Style/Filling drop-down menu on the main toolbar. You can additionally insert text into your illustrations.

 

OpenOffice.org Draw also allows you to open and import images and modify them with the tools provided. When you complete your illustration or image modifications, you can save the file in one of several native file formats or export your work to a universal format such as .jpg or .png. Refer to Table 8-1 for the complete list of compatible image file formats.

 

8.2. Viewing PDFs

A PDF (Portable Document Format) file is an electronic image of a document. PDF captures formatting information from a variety of desktop publishing applications, making it possible to send formatted documents and have them appear on the recipient's monitor or printer as they were intended. To view a PDF you must have a PDF reader. An open source application called xpdf is included with Red Hat Linux. To see a list of menu options, right-click inside the screen. The toolbar at the bottom has navigational tools that let you move backward and forward through the document, as well as standard zoom, print, and find tools. The xpdf man page provides useful information on the xpdf options.

 

To view the xpdf man page, at a shell prompt type  man xpdf.

 

To view a PDF with xpdf:

1. In your desktop environment, go to Main Menu => Graphics => xpdf. You can also launch xpdf by typing xpdf at

    a shell prompt.

2. Right-click in the xpdf screen to display a list of options.

3. Select Open to display a list of files.

4. Select the PDF file you want to view and click on Open.

 

Another popular PDF viewer is Adobe Acrobat Reader. While it is not included with Red Hat Linux, you can download it free of charge at http://www.adobe.com/