Lesson 7: Selecting Complex Shapes In Lesson 4, we used some simple basic tools to select part of an image. In this lesson, I'll cover selection of complex shapes. I'll use a butterfly as my sample: http://shallowsky.com/images/gimpcourse/lesson7/butterfly.jpg GENERAL ADVICE When selecting images out of an image, there are two important tricks: (1) Zoom the image as much as you can, so you can see what you're doing, and (2) Turn on "feathering". You may remember zooming from Lesson 1: it changes the size at which the image is displayed. Use the View->Zoom menu, or (in gimp 2.2) the menu at the bottom of the image window; or just hit ctrl-= or ctrl-+ repeatedly until the image is as big as you need it to be. Feathering means making the edges of the selection "fuzzy". The edge will only be partially selected, so if you paste such a selection, the edges will merge with the background below it. This is important when you're cutting shapes out of an image, because it helps you avoid sharp edges that make it obvious that the image has been changed. Most selection tools have Feathering as an option in their Tool options. LASSO SELECT We touched briefly on the Lasso selection tool in the last lesson. With it, you can draw an outline around an object in order to select that object. But as a few of you found out when you tried to use it to cut out specific objects, it's tricky to use: you have to hold the mouse down and drag out the whole shape in one complex motion. BEZIER PATHS That's where Bezier Paths come in! The Bezier (pronounced "bez-ee-ay") Path tool looks sort of like a fountain pen drawing a thread through a wire with lumps on it. :-) The tooltip says "Create and Edit Paths" or "Select Regions with Bezier curves". Don't get it confused with the "magic scissors" tool right next to it, which is somewhat similar (I'll talk about that in a minute). The Paths tool lets you define a selection of any shape, like the Lasso, but with Paths, you can go step by step, stop to take a rest, and edit the path later. One thing that means is that you can zoom waaaay in on the image. Make it huge, like 300 or 400% of actual size. It's okay if you need scrollbars. The important thing is that it's big enough that you can click exactly where you need to, and not have to worry about whether your hand is accurate enough with the mouse. Time to start! Click-and-release the mouse button wherever you want to start your selection. Then click a little farther down the line. Continue around the image, playing "connect the dots" all the way around. Make the dots as close together or as far apart as you need to to follow the object's contour. If you need to scroll, go ahead and do so. The mousewheel works for scrolling vertically, if you don't want to break your concentration by moving over to the scrollbar. What if you click in the wrong place? You can edit bezier points at any time. In gimp 2 this is easy: go back and mouse over the errant point (watch the mouse cursor carefully, and make sure it switches to the crossed-arrow icon that means "move" in gimp), then move it. "Undo" also works in gimp 2 to remove the last point, in case you clicked in the wrong place. In gimp 1, ctrl-click seems to move the current point. (If you hold down Alt you'll see the cursor change to a "move" icon, but that moves the whole path, not just one point.) When you finally get all the way around your object and back to the first point, click on the first point again to "close" the path. Look over your path. You have a nice connect-the-dots of straight lines framing your image. If you made the dots close enough together, this is probably good enough. But if you want to make the line follow your object's outlines even more closely, you can make the lines curve! In gimp 2, click on Edit Mode: Edit in the tool options. (Gimp 1 is always in this mode.) Now, if you click on one of your dots and drag away a little bit, "handles" will sprout from that point, and by dragging the handles around, you can make the lines adjacent to that point curve rather than being straight. Try it -- it's easier to see than it is to explain. In truth, I don't use the bezier handles very often. It's usually easier to make a lot of points connected by straight lines. But it's worthwhile knowing that the handles are there if you ever need them. Now you have a path, and you've adjusted your points' positions and handles as much as you're doing to. You've probably spent quite a lot of time on this: making a good path is hard work, and takes a lot of concentration. So at this point, I often make a backup copy of the path. Go to the Layers dialog and select Paths from the tabs at the top. You'll see the path you just created there. Select "Duplicate Path", either by right-clicking on the path's line in the Paths dialog, or by clicking on the Duplicate button down at the bottom of the dialog. You might also want to name the path, by double-clicking on the path, which selects the name and lets you type in a new name. At this point, I recommend saving as XCF, if you haven't already done so. This will save the path and the selection, so you won't lose it. Now turn the path into a selection: "Path to Selection", either from the button at the bottom of the dialog, the right-click menu on the path, or (in gimp 2) "Create selection from path" in tool options, back in the toolbox window. My selection looks like this: http://shallowsky.com/images/gimpcourse/lesson7/butterfly-selected.jpg FEATHERING A PATH-BASED SELECTION Voila! You have a beautiful selection. But what about feathering? Gimp 1.2 has a Feathering checkbox in the Bezier Selection Tool Options dialog, like most selection tools. But that option is gone from Gimp 2! In gimp 2, you'll have to use the menus after your selection is made: Select->Feather... You can use that on any selection: sometimes it's useful if you've made a rectangular or lasso selection and decide later that it needs the edges feathered. INTELLIGENT SCISSORS GIMP has a second path tool: the so-called "intelligent scissors", the scissors icon right next to the path tool (with the tooltip "Select Shapes from Image"). The Scissors tool creates a path, just like the regular path tool; but each time you click to create a new point, it tries to guess where you really wanted it, and warp it there, following whatever it can find that looks like an outline or sharp boundary. Some people like it; others don't. Try it and see if it works for you. But most people end up using the regular path tool instead of the scissors. RUNNING FILTERS ON SELECTIONS You've made your selection. What can you do with it? Of course, you can copy, then paste into another image: http://shallowsky.com/images/gimpcourse/lesson7/butterfly-on-white.jpg But in addition, most gimp operations will operate only on the selection, if a selection exists. For example, in this image, the background is a bit busy. All the leaves detract a little from the butterfly. If I make them darker compared to the butterfly, the butterfly itself will stand out better. INVERTING THE SELECTION Since I want to darken the background, not brighten the butterfly, what I really want is a selection that includes everything *except* the butterfly: the exact opposite of the selection I have now. That's easy: from the menus, Select->Invert. Now I bring up my any brightness tool from Lesson 2 (I'll use Curves) and fiddle with the controls, and watch the background change. HIDING THE SELECTION BOUNDARY The only problem is that I can't see whether the boundary looks too obvious, because now those darned "marching ants" are getting in the way. But I can make the marching ants disappear temporarily: View->Show Selection, or ctrl-T ("toggle selection"). WARNING: toggling selection visibility off is somewhat dangerous, because the next time you use selection, you'll try to make a selection and no marching ants will appear and you'll get all confused. Or you'll try to draw something, and it will only draw in part of the image (where the selection is). Or at least, I get confused by that. So try to remember to toggle selection back on immediately after you're finished working on a selection. With the marching ants gone, I can see what I'm doing, and I turn the background's brightness down to enhance the butterfly, which reamains bright: http://shallowsky.com/images/gimpcourse/lesson7/butterfly-darkbg.jpg You can use this technique with most gimp filters: you can sharpen an object while leaving the background unchanged, or even blur the background. BLURRING You may have noticed all those blur options in gimp's menus, and wondered, "Why would anyone want to make a picture more blurry than it already is?" Blurring is actually surprisingly useful. For instance, those drop shadows we've been using so much are made by making a copy of your text, changing the color to black, then blurring the result. Blurring can also be useful to de-emphasize parts of an image that are distracting. In this case, I'll blur the leaves, which will make the butterfly look sharper in comparison. Blur is a submenu, Filters->Blur, and there are lots of types. I usually use Gaussian Blur, and in gimp 1.2, where there are two types of Gaussian Blur, just pick one -- they're very similar. But do experiment with some of the others, like Motion Blur -- they can be fun when you want special effects. Experiment with blur radius. Gimp 2 has a preview in the blur dialog, so you can see exactly what the effect will be. With gimp 1, just try something, and undo if you decide you want more or less blur. Here's my butterfly with a blur radius of 20 (looks unrealistic): http://shallowsky.com/images/gimpcourse/lesson7/butterfly-blur.jpg and with a blur radius of 7 (more subtle and, IMO, better): http://shallowsky.com/images/gimpcourse/lesson7/butterfly-lessblur.jpg Homework: Select a complex shape from an image, using path or intelligent scissors, and apply any gimp filter (or combination of filters) to either the shape or its background. Or, if you prefer, just paste the shape into another image. Next lesson: How to get really cool looking text.