easy image contour extraction

Yep, I know – yet another tutorial on how to extract an image from its background.

Only this time, It’s about extracting images with sensitive areas (such as shadows, hair etc.) from relatively uniform backgrounds. We’re going to use for this example a human face, taken, with thanks, from imageafter.com.

OK, let’s get to it.

1. Open the image

2. In the Layers palette, double-click on the Background layer, to unblock it.

This will open up a confirmation dialogue – just click OK to move on.

3. In the same Layers palette, click the Create a new layer button, to… uh… create a new layer

4. Then move this new layer below the first one, and fill it with a strong colour, that will help us later better see what’s going on. We should now have something like this in the Layers palette:

5. Click again on the layer containing the photo, to re-select it, then from the main menu of the application choose Select > Color Range…

This will open up a dialogue, which I’ll want you to set up as presented in the image below:

6. You’ll notice 3 eyedropper icons, of which the first from the left should (and must) be selected. Ok, now we’ll want to select, from the image, the color that’s the most prevalent in the background that we want to eliminate. In this example, for instance, we’ll want to select the strongest blue from the sky. You get this by moving the eyedropper cursor over the original image and click on the spot that best matches the color I was talking about. By doing this, you’ll see the resulting selection as white in the popup preview, with the “unselected” image marked as black. Fiddle with this a bit, untill you get the most convincing white-dark contrast around the edges of the object. Then, ofcourse, click OK

The result: a selection marquee (those pesky marching ants) marking the selection we’ve just made:

7. Now, with the layer containing the foto selected, click on the Add layer mask button:

8. This will mask, from the photo layer, everything but the selection we’ve made, something like in the image below, WHICH IS OK

9. Now, in the Layers palette, make sure that you have selected the MASK, and NOT THE LAYER. Once you’re ok with that, choose a brush, set a WHITE foreground colour and start wiping out any “greens” left out in the sky. We’re after something like this (a green alien on a perfectly gren-free sky):

10 Once you’ve done that, all you have to do now is to invert the MASK (CTRL+I) and hide the green layer below. The rough result should look something like this:

That’s it! You’ll probably ask “what was all that about the green layer? does it even have to be green?” My answer to you is that such a “wild colour layer” does nothing but help better contrast what must go and what must remain in our image. It’s, as I was saying, just a helper, to be discarded in the end.

Welp, I made this with a human face, which is fully opaque. If you’re planning to “do” a car instead, for instance, you’ll probably get empty spots in the green shape of the car (what with highlights and so on). You guessed it: you’ll have to fill in those gaps in the mask with a BLACK brush (resulting in green on the image), so that the final result may be exactly like here: fully-green object on fully green-free background.


7 Responses to “easy image contour extraction”

Leave a Reply

− three = 1