Sunday, December 28, 2008

Off with his Head (3a)

Welcome back. So far you have a basic target image for our exercise which has a layer created in it for the sake of laying on a victim's head, you have blown that image up to double resolution for the sake of our exercise, and you have selected a new head out of an old image using the scissor select tool.

Before we get to the nuts and bolts today -- and this is a long lesson, so bring a lunch -- let's look at some of the challenge we face in the project.

Here's our target image, the pro wrestler "Batista":



And here's my friend Phil:



The first major challenge to get what we want here is the way Batista has his head tilted. It's very roguish, I am sure, but it leaves his neck at an awkward angle. While we are working here, we're going to have to make sure we tilt Phil's head in a like manner. Also of note is the fact that Batista's profile is a sort of 3/4th view of his head. We're lucky (not really lucky; I picked this picture of Phil’s head for this purpose) that Phil's head is also a sort of 3/4ths view, but notice that their heads are not exactly the same size and shape. We're going to have to remove some of Batista's head before we lay in Phil's head to get a more natural look.

The last major challenge -- which is probably the key to making this project really work -- is that Batista obviously spends a lot of time in some way sunning himself. He has a marvelous bronze complexion -- and my friend Phil not so much. Phil has a normal, human skin tone. If we paste Phil's head on Batista's neck without some kind of color adjustment, we're going to have an extremely-unnatural edit, and our project is going to be less than successful.

So: last time we learned how to select Phil's head out of the "victim_head" image. Since it's relatively easy, deselect that image. We'll reselect using the scissor select tool in a few minutes, but now deselect and use your layers dialog to add a layer to the image containing Phil's head.



Now go back to the image of Batista. I have blown up a section of the image here:



Look in the area inside the red circle I made -- there you can find the darkest tones on Batista's skin. What we want to do is select the darkest of these tones into our color pallet. To do that, use your eye dropper tool (also called the "color picker"), select the Batista image, and move the dropper over one of these darker areas and click, so you get something like this in your color pallet:



Right now, some of you are saying, "Frank: the eye dropper isn't selecting any color." Yes, well, look at your layers dialog. You have the "new head" layer selected instead of the "Background". If you select the background layer and try again, you'll have better success.

So what we have is a sample of color from Batista's skin, and we want to make Phil's skin look that sunny and brown. This is a somewhat-advanced technique, so I'm going to go slowly.

What we DO NOT want to do is simply use the bucket tool and pour the color onto Phil's face. That will simply leave giant blobs of color on Phil's face and give us a completely-useless result. What we are going to do instead is create a layer of the dark skin tone we just pickered off of Batista, and saturate Phil's skin tone with that color.

Go back to the image of Phil's face. Make sure you have selected the new layer we made a minute ago, and use the bucket tool to fill that layer with the skin tone color. Your main image should look like this:



And your layers dialog should look like this:



To get a preview of what we're about to do, go to your layers dialog, and notice the "mode" menu near the top of the dialog.



Select the "new color" layer and drop down the "mode" menu to select the mode "color". In our preview of what we're about to do to Phil, you'll see something that looks like an aged photo -- something you may have seen called a "sepia tone" image. So in effect, you have just gotten a little side-lesson in how to make your normal photos into sepia-colored images.

This technique, btw, is the GiMP version of the Photoshop “apply image” command – we are blending two images to get a final result which capitalizes on various aspects of the originals. We just have one image with is, obvious, just a single color. What we are doing is using a “blend mode” on the single-color layer called “color” – a blend mode which applies the color of the selected layer to the layer immediately under it. And that’s all the geek-speak about this you’ll get today.

We don't want this image to be a sepia-tone image: we only want Phil's skin to get bronzed up -- but his hair and eyes need to look like they are the right color. So for now, it's fine to leave the "new color" layer in "color" mode. To disable it for a second, click the eyeball in the layers dialog to make the "new color" layer invisible, and we'll return to Phil.

We have a couple of choices to get rid of the bronze color in unwanted areas, and we're going to do the easiest one first. Go select your "Select by color" tool:



You will notice that Phil's hair and his jacket (at least insofar as this photo is concerned) are pretty close to the same color. In your "layers" dialog, select the "background" layer. In your "select by color" tool options dialog, set the threshold to "33.0", like this:



What that means is that when you click the tool on a color in this image, it will select that color and any color like it out to a threshold of "33". To tell you more than that is to bore you with geek speak, and you're already bored enough.

I got the best success with this image by clicking on a dark area in Phil's jacket, and then holding down the "shift" key so I could make a second selection and merge it with the first, selecting a part of the dark area in Phil's hair which wasn't selected in the first pass. My result looks like this:



You might get lucky at this threshold level and get a robust selection on the first click if you find a color in the right range. But once you have your selection, make the "new color" layer visible again and select it in the layers dialog. You'll notice your selection of the darker features of this image are still selected when the bronzing layer is added back into the mix -- which is exactly what we want. Now all you have to do is hit the "delete" key -- and BINGO! The bronze is removed from the dark areas of the image.

The very-fussy among you will want to grab the eraser tool and clean up the flecks of bronze in Phil's hair. I leave that to your discretion.

However, the rest of us are going to take the eraser tool in-hand for another purpose: unbronzing Phil's eyes. Set the tool's brush to "Circle(11)", and make sure you're in the "new color" layer still. That circle size should be the right size to easily clear the bronze out from Phil's pupils -- and leave us with a very fine result.

Now, look: it's not hardly the best result you could have that this point. You might want to de-bronze Phil's beard a bit; you might want to touch up his hairline for bronzing issues. But because this step in the cut-and-paste is so long in and of itself, I am not going to be that kind of a purist today.

What I'm going to do at this point is flatten the layers of this image to make the bronzing stick. Go to the "Image" menu, and select "Flatten Image".



And at last I'm going to use the scissors-select tool we learned to use last time and cut Phil's head out of the victim's source image and into the target image, thus:


You'll notice in this image that Phil's head is safely in its own layer, waiting for us to use it in our evil plot. Until further notice, make the layer invisible.

Because this step is so longer, we’re going to call it quits in the middle before we rotate, scale, and apply the new head after erasing parts of the old head to make sure it doesn’t show through. The really-eager among you will, of course, work (ahem) ahead. The rest of you will have to wait for my next installment.