Test Driving Linux/Edit Digital Images
These days, it seems like everybody has a digital camera. If they don't have a digital version of a traditional film camera, they have one built into their cell phone or PDA. The increasing popularity of digital cameras naturally leads to more digital pictures, which in turn leads to the need to store, manage, and manipulate those pictures. That's where this chapter comes in. It shows you the programs included on Move that will help you get your images off your digital camera, view them on your computer, and edit them to your heart's content.
The crown jewel of this small collection of software is the GNU Image Manipulation Program, known as the GIMP. This handy program is considered by some to be a capable alternative to Adobe Photoshop, and considering that the GIMP is free and Photoshop costs more than $600, it is probably worth your time to find out if this is true for you. Though the GIMP was originally developed for Linux and Unix systems, there is now a Windows version you can try out as well. Visit http://www.gimp.org for more information.
Before you can view or edit your digital images, you first need an image to edit. Though Move does come with a few wallpaper images, they aren't particularly interesting to work with. You can download all kinds of images off the Web, but you may prefer to work with pictures that have more personal value to you.
If you already have digital photos on your Windows hard drive, you can access them using the method described at the end of Chapter 3. Since Move cannot write data to your hard drive, you need to copy the file to your Home directory on a USB key if you want to save any changes to an edited image. Reading and writing changes to your USB key takes time, so be prepared to wait several seconds for changes to happen to very large images.
You can also work with images stored on your Compact Flash, Secure Digital, or other camera storage medium. To do this, you need to have a media reader on your computer—usually, a USB device that you can stick the flash-based memory card into. When you plug in your media card reader, Move should add an icon on your desktop, usually labeled Hard Disc, to let you access the device. When you double-click the icon, it opens in Konqueror and you can navigate to where the images are stored. Though you can view the images directly from the flash media, you have to transfer them to your Home directory before you can edit them. For your own safety, Move does not allow you to edit the file directly.
Once you can access your images, you'll probably want a convenient way to view them. There are dozens of programs on Linux for viewing images, but Move comes with just a few. You have probably already noticed that Konqueror shows you thumbnail views of any image in a directory. To see this in action, type the following into Konqueror's Location field and press Enter:
When the wallpapers directory loads, it generates thumbnails of all the images in the directory (Figure 7-1). To view an image full-size, simply double-click its icon to load the image inside of Konqueror. Though this is a convenient way to view an image quickly, you cannot manipulate your view of the image, such as rotating it or zooming in or out.
For more control over how you view your images, you need to use an external viewing program such as GQview. To open an image with this program, simply right-click on the image icon inside Konqueror and choose Open With → GQview (Figure 7-2). The GQview program window is divided into three panes: the top left pane allows you to navigate to the directories where your images are stored, the pane below that lists the image files in the currently selected directory, and the large pane to the right displays the chosen image. A small toolbar and the programs menus are located in the upper-left corner.
Press F to view the image full-screen. You can press the spacebar to see the next image in the directory, and the backspace key to see a previous image. This is an easy way to rapidly view all the files in a directory—it's kind of like a digital photo album. GQview can also perform a slideshow for you. To do this, exit the full-screen mode by pressing the F key again, and in the image list on the left, select the images you want in your slideshow. (Use the Shift-click and Ctrl-click methods described in Chapter 1 to select multiple images.) Once you've selected your images, right-click on one in the view pane on the right and choose "Start slideshow" (or just press the S key). The slideshow will change images every 15 seconds; to change the time interval, click View → Options and make the adjustment in the "Slide show" section at the bottom.
Right-clicking on an image in GQview gives you several other options. You can zoom in and out, autofit the image to the window size, and, under the Adjust menu, you can rotate, mirror, or flip the image. This is useful for rotating images that appear sideways because you held the camera vertically when you took the picture.
Getting to Know the GIMP
The GIMP is not the only image editing program on Linux, but it is the best known. Though it's not as full-featured as Adobe Photoshop, the GIMP should be able to handle the image editing chores of most non-professional users. Using the GIMP, you can resize, crop, color-correct, and combine images, fix blemishes, and perform hundreds of other tasks.
Move comes with version 1.2 of the GIMP, which is actually quite dated. Though the current version 2.2 looks different, what I write here still applies.
To launch the GIMP, go to K Menu → View, modify, and create graphics → Edit images and photos, or simply click its icon on the kicker (it looks like a cartoon dog with a big nose). Alternately, you can right-click on an image file and choose Open With → The GIMP. When the program launches for the first time, it will ask you several configuration questions. Unless you have reason to do otherwise, just accept the defaults by clicking Continue on each screen.
If your USB key is smaller than 64 MB, pay attention to the third configuration screen. This screen asks you how large a Tile Cache Size you want, which determines how much hard disk space (or USB key space) the GIMP reserves to hold its image data. The setting defaults to 32 MB, and you should adjust it depending upon how much space is actually available on your USB key.
The GIMP displays several small windows when it opens, including an image window if you opened it by right-clicking an image file. If you're not familiar with image editing tools, these windows could use some explanation:
- GIMP Tip of the Day
- This is the typical Tip window you see when many programs start up. You can click through the available tips with the Previous Tip and Next Tip buttons, click Close to make it go away until the next time you start the GIMP, or uncheck "Show tip next time GIMP starts" and click Close if you want to get rid of it for good.
- Tools Palette (labeled The GIMP)
- This is the GIMP's main window (Figure 7-3). In addition to the main menu, this window holds all the tools you use to edit your image. When you close this window, the entire program closes.
- Tools Options
- This window displays a set of options that affect the tool selected in the tools palette. Each time you click on a new tool, check this window to see what features are available for it. If you accidentally close this window, you can bring it back up by double-clicking a tool's icon in the tools palette.
- Brush Selection
- This is the digital equivalent of an artist's paintbrush collection. The brush sizes you choose here affect the tools in the main window. For instance, if you're using a line drawing tool, the choices in the top row of this window affect the width of the lines you draw.
- Layers, Channels & Paths
- This palette controls the layers in an image. You can think of image layers like layers of clothing, but unlike layers of clothing you can manipulate any layer, not just the top one. Imagine being able to take off your t-shirt without needing to take off your sweater and coat first. In an image, if the t-shirt is on a different layer than the sweater and the coat, you can remove the t-shirt and leave the other two pieces of clothing in place with a single click.
- The image window is where you view and edit an open image. The GIMP auto-adjusts the size of your image to fit the screen; if you look at the title bar of this window, you can see what percentage of the actual size the GIMP has set your image to.
If you look at the menu choices in the main GIMP menu, you may be surprised at how little is actually there. There are two reasons the menus are sparse. One is that many of the functions that are normally assigned to a menu in other software interfaces are handled in the GIMP by icons and options in the various palettes. The other is that most options are assigned to the menu that appears when you right-click an actual image. This might seem like a weird place to put so many options, but when you think about it, it does make sense. It's useful to have the menu choices close at hand so that you don't have to drag your mouse all the way to the main menu bar just to select a new action.
The GIMP supports multiple levels of Undo. If you make a mistake, you can press Ctrl-Z to remove your most recent changes, or Ctrl-R to redo a recent change. The GIMP is configured to allow five levels of Undo; you can increase this number using the GIMP's preferences panel, which is opened by clicking File → Preferences. This configuration window has a lot of useful settings to manipulate the GIMP's behavior; click on the Environment category to reach the Undo setting. Because each additional level of Undo requires more system memory, I suggest you don't set this value higher than you typically need. Within the memory-constrained environment of the Move CD, it's probably best not to change it at all.
Many image editing programs offer built-in functions that can do interesting things to your photos. In the GIMP, you can access these functions by right-clicking on an image and making a selection from the Filters or Script-Fu menu. I would normally encourage you to play around with all these options, but because accessing an image from a USB key is very slow, this kind of experimentation will take a long time—many of the menu choices may take a minute or more to affect your image.
Obviously, I can't cover everything that the GIMP can do in this chapter, but the following sections describe a few basic things that I find myself using the GIMP for fairly often.
I don't imagine myself an expert on photographic technique, but every now and then I realize that a particular picture is best taken as a portrait rather than a landscape, so I turn my camera on its end and click away. Of course, this produces pictures that are turned 90 degrees in one direction. When thumbing through a stack of printed pictures, it is easy enough to turn a picture 90 degrees to view it properly. But when looking at digital photos you usually have to select a menu option to rotate the picture, which can get awfully tedious when viewing a large number of photos and sharing them with friends. However, using the GIMP you can rotate the image permanently, so you won't get a crick in your neck the next time you view your photos.
To begin, go to File → Open and select the image you want to rotate from the file browser. (You may notice that this window is a bit different from the ones you've seen so far in KDE. This is because the GIMP is not a KDE application, so it doesn't share the common KDE Save and Open dialogs. One thing to note about this particular Open window is that if you want to move to a directory above the one you are in, you must double click on the ../ in the Directories pane.)
Once you've got the image open, right-click it, choose Image → Transforms → Rotate from the menu, and select the appropriate degree of rotation. Remember, because of slow USB key access speeds this rotation may take quite a bit of time to complete, so give it a couple of minutes before you give up on it. To save the rotated image, right-click it and choose File → Save. Figure 7-4 and Figure 7-5 show a picture of one of my cats before and after I rotated the image.
Another common task you'll perform when working with digital photos is resizing the images. Modern megapixel (MP) cameras produce really outstanding images, but the files are several megabytes in size and not suitable for sending in email or displaying on a web page. Using the GIMP, you can easily resize the picture so that it takes up less space and isn't 20" wide and 15" tall.
To understand the best way to resize a picture, you first need to know a few things about digital images, so I'll explain the important concepts here. If you go back to the picture of my cat in Figure 7-5, you'll see on the titlebar that the image is being displayed at 33 percent of its full size. To see just how big an image really is, you need to right-click on it and choose Image → Scale Image. This brings up the window shown in Figure 7-6. By looking at the Print Size & Display Unit section, you can see that this picture is 21.444" wide and 28.889" high. That's huge. If I were to put this image up on a web page, it would be bigger than the screen of anyone who viewed it.
The size of an image is determined by its width and height in pixels combined with the dots per inch (DPI) at which you are viewing it. When I first launched the GIMP, I accepted the default setting of 72 DPI. This used to be a very common setting on most computers, and means that 72 pixels take up exactly one inch of display on the computer screen. If you look at the Pixel Dimensions section of the Scale Image window, you'll see that my image takes up 1544 2080 pixels. If you do the math and divide these two numbers by 72, you'll get the dimensions I mentioned earlier. If I sent this image to a computer user whose screen was set up for 96 DPI (a common setting on many new computers), the picture wouldn't be quite so huge—16.083" 21.667"—but it would still be much too large.
In addition to the size of the image on the screen, you have to take the size of the image file into account. This picture of my cat, taken with a 3MP camera, is currently 675 KB in size. Though this is small enough to email to most people, if the recipient is on dial-up it could take a minute or more to download. Thankfully, when you scale down the size of the image, the file size is reduced as well.
Reducing the image size is easy. In the Scale Image window, just type in a new value for any one of the dimensions—either the width or the height in either pixels or inches—and click OK. The GIMP auto-adjusts the other values to keep the image properly scaled (i.e., it won't stretch out your cat and make him look even fatter than he already is). I usually set the width of a portrait picture to 600 pixels, which sets the height to around 800 pixels. (In a landscape portrait, the two numbers would be reversed.) In the case of my cat, the pixel dimensions 600 808 give the picture a size of 8.333" 11.222".
To save your new settings, right-click on the image and choose File → Save. Now when I check the size of the file, it is only 46 KB—less than one-tenth the space it took up before I resized it. My email correspondents will be grateful. And as long as the picture is viewed at 100% actual size or less, there shouldn't be any noticeable quality change.
When my wife and I were in Vienna a few years ago, I took a lot of pictures of her in various gardens and palaces using a regular film camera. I thought I had framed each picture perfectly, but when I developed my pictures I realized I had not zoomed in closely enough. In almost every picture my wife was too small, and there was a lot of background material that wasn't particularly interesting. I'm sure I'm not the only person who makes this mistake, but thankfully it is easy to correct in the GIMP by cropping, or cutting out, the unwanted parts of the picture.
Figure 7-7 shows a picture of my other cat crouching underneath the coffee table. It's not a great picture, partly because there are some distracting elements around the edges that just don't need to be there. This is a good example of an image that needs to be cropped.
To select the cropping tool in the GIMP, click its icon in the main palette. (It looks like a small scalpel, and the tooltip "Crop or resize the image" will appear when you hover your mouse over it.) Now, when you move your cursor over the image, you'll see that the cursor has changed to a small crosshair with a strange symbol in the lower right. To use the cropping tool, left-click on the image and drag your cursor to create a box around the part of the picture you want to keep. Once the box is in place, you can tweak it by using the handles at the corners—the handles at the top right and lower left let you move the whole crop box, while the ones at the top left and lower right let you move the bounding lines horizontally and vertically. Once you have the crop box positioned exactly the way you like, click once inside the box to perform the actual crop (or click the Crop button in the Crop & Resize Information window that appeared when you started the cropping process). Voila! You now have a new image without any unwanted parts in it. As usual, to make the change permanent, you need to save the image by right-clicking on it and choosing File → Save. (Or, if you don't want to overwrite the original figure, select File → Save As.) Figure 7-8 shows the newly cropped image of my cat, without any stray feet in the picture.
Remove Red Eye
I expect that everyone has a photograph in their collection that is perfect in every way, with the exception of the subject's glowing red eyes. Red eye is caused by the light of the camera's flash reflecting off the subject's retinas. Though many cameras come with a red-eye reducing flash, it doesn't always work. As a result, removing red eye is one of the most common tasks you'll use an image editing tool for.
There are several ways to remove red eye using the GIMP. The method I'll cover here is not only easy to use, but it will introduce you to a few tools we haven't gotten to yet. For this example, I'm going to use the cropped image of my red-eyed cat shown in Figure 7-8.
With your picture loaded, zoom in on the troublesome eye by clicking on the image window and pressing the = key on the keyboard (press the - key to zoom out). For my particular image, a zoom level of 500 percent worked well. You will have to center the image on the eye after you zoom by using the slider bars in the image window.
Now bring your Layers, Channels & Paths window to the front and click on the Channels tab. There are three entries here: Red, Green, and Blue. Every color in an image is a combination of varying amounts of these three colors. By adjusting these channels, you can affect only certain colors in an image; and since your goal here is to remove red eye, you obviously will be working only with the Red channel. Click once on the words Green and Blue to remove the highlighting and deactivate those channels. Now, when you use a color tool on the image, it will affect only the color red. (Be careful not to click on the iconic eye next to each channel name; this will hide that color in the image and make it more difficult to work with.)
To remove red eye from your image, you're going to use a technique known as burning. Select the burn tool from the main tools palette—the icon looks like a small wand with a black circle on the end, and it has the tooltip "Dodge and Burn." The Tool Options window will change to show you the options available for this tool. Set the tool to burn by checking the Burn box, and then set the Mode to Highlights. There is no need to click OK or Apply for these changes to take effect.
Now you need to select a brush size in the Brush Selection window. This will determine the size of the area that is affected when you perform your "burn." For reducing red eye, you'll probably want to select a brush with fuzzy edges; such brushes apply a change 100 percent at the center of the brush and to a lesser amount around the edges, which gives your changes a softer and more natural look. As you click on each brush, you will see a description of the brush and the number of pixels affected by it at the top of the window. For close-up work like this, you'll want to use a brush size of 11 or less. You might need to switch to an even smaller brush when you work near the edges.
Now all you need to do is click on the red portions of your image and the burn tool will remove the red. You'll probably need to click a specific spot multiple times. It will look like you are painting black on the image, but you're actually removing all the color of the active channel, and of course the absence of color is black. Keep in mind that this can be time-consuming and delicate work, so be patient. If you make a mistake, press Ctrl-Z to undo the change. Figure 7-9 shows you the results of my red-eye removal attempt. I think you'll agree that my cat looks much less demonic now.
Linux users love to share screenshots of their desktops and applications—perhaps because Linux is so highly customizable and it is interesting to see how someone has personalized their desktop. (You'll learn all about customizing KDE in Chapter 8.) In order to share your screenshots, you first need to learn how to make them. To this end, Move includes the program KSnapshot, which can take screenshots of specific windows, the entire screen, or a selected portion of the screen.
- To launch KSnapshot, click K Menu → View, modify and create graphics → Create a screenshot. Figure 7-10 shows you the only window in the program. Taking a screenshot is a fairly simple process. Select the type of screenshot you want to create from the "Capture mode" drop-down list.
- Select a time in the "Snapshot delay" field, which determines how long KSnapshot will wait before it actually takes the screenshot. Setting a delay of a few seconds gives you enough time to open a program window or expand a menu you want to be in the screenshot.
- Click the New Snapshot button to take the screenshot. The KSnapshot program disappears until the screenshot is taken, to ensure that it does not appear in the final image. If you selected the Fullscreen capture mode, you just have to wait for the screenshot to be taken. If you chose Window Under Cursor, you need to click on the window you want in the screenshot before the Snapshot delay expires. And if you selected Region, you have to use your mouse to draw a box around the portion of the screen you want to capture. When you release your mouse button the screenshot "snaps."
- Once the screenshot is taken, click the Save As button to save it. KSnapshot saves images only in PNG format, which is an open standard that combines some of the best qualities of GIF and JPEG images.
And that's all there is to it. All of the screenshots in this book were taken using this tool (with the exception of the one of the program itself, of course, for which I used the GIMP).