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
tiffetz_01.jpg

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

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

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

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:
tiffetz_05.gif

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…
tiffetz_06.gif

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

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:
tiffetz_08.jpg

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

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

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):
tiffetz_11.jpg

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:
tiffetz_12.jpg

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.

Enjoy!


7 Responses to “easy image contour extraction”


Leave a Reply


three × 2 =