Downloaded from www.biorust.com on Sat Nov 07, 2009 22:04:05

 
Using Calculations & Channels To Create Masks
Tutorial Author - Zapphnath (http://forums.biorust.com/member.php?userid=11761)

We all agree that masks are extremely useful and, in most circumstances, look a whole lot better than cutting the object out of it's background with the Lasso or Pen Tool. I'm sure we all, also, agree that they can take quite a long time to create, depending on the detail involved in the image. Wouldn't it be nice if there were an easier, quicker way to get, at least, the basic shape separated from the rest? Well, in some cases, there is! Be forewarned, however, that this method doesn't work for every image - Being based, primarily, on the Channels, (therefore, the colors of the image), the background and object need to be of contrasting colors. A brown-skinned person with brown hair on a brown background may not give as good results as, say, a red bird on a blue background, for example.

 
01

The Technique
I've chosen an image, (fig.01), with a great deal of color contrast. The parrot and branch stand out from the blue sky quite well. Switching to the Channels palette, we can see that, for this image, the Red Channel shows the upper half of the bird as being very bright while the rest of the image is made up of similar shades of gray. The Green and Blue Channels show a bit more contrast, especially the Blue one, which shows the sky as nearly white, (fig.02).

For those who don't know, each Channel represents the amount of that color in the image. The brighter a particular pixel, the more of that color the pixel contains. Black areas contain little or none of that color.

There is a neat little function, under the Image menu, that's been a part of Photoshop all along, but isn't used or even discussed very much, anymore. It's called Calculations. Opening the Calculations dialog, we see that we can choose any two channels and mix them using any of a variety of Blending modes. For this image, I chose to mix the Green and Blue Channels, using Linear Light as the Blending mode. I chose Linear Light because, in this instance, it gave the best results. Of course, each image will vary and you'll have to try them all to find the one that works for the image you're working on. On a side note, there are two new Blending options that are only available in Calculations. They are Add and Subtract and they do just what they say: add one channel to the other or subtract one channel from the other. You can, also, invert one channel or the other, (or both), to get different results.

Hitting "OK", in the Calculations dialog, will create a new Channel, named Alpha 1, (fig.03). We can see that this new channel is black&white, and high in contrast. A slight Levels adjustment, (under Image > Adjustments > Levels), bringing the black and white sliders in a little bit toward the center, (66, 1.0, 211) gets rid of the gray area in the sky above the bird. (fig.04).

The mask is, at this point, almost ready. It needs to be cleaned up a little bit, though, so we should use the Paintbrush to paint out the leaves in the background with white and the leftover details in the bird and branch with black, (fig.05). At this point, go to Image > Adjustments > Invert to reverse the black and white areas of the image, (fig.06), and you're done. Click on the RGB Channel, which will select and make visible the RGB (Red, Green, and Blue) Channels, then hold Control (or OPT if you are using a Mac) and click on the Alpha 1 Channel to form a "marching ants" selection around the bird and his branch. Now, switch to the Layers palette, copy the background layer, by clicking on it and dragging it to the Add New Layer icon at the bottom of the Layers palette (next to the Trashcan), then click the Add Layer Mask button, (second from the left, in the bottom of the Layers palette - looks like a box with a circle in it). You'll have to click the "eye" icon next to the original, non-masked layer to turn off it's visibility so that you can see what was done. (Masks don't work on locked background layers and copying it is quicker than unlocking it). Fig.07 shows the bird, masked out, on a simple white background and Fig.08 and Fig.09 show it on a couple of other backgrounds.

As I said, before, the image, itself, determines how well this method is going to work. With a little luck, you can use this method to mask out objects with a fair amount of intricate details, such as fur or hair.

02
03
04
05
06

 07  08  09

 

Extra Hints & Tips
Here's an extra tip for those times when you'd like to shrink or grow the mask while keeping it's shape: If you do a Gaussian Blur on the mask (just a few pixels, at most) then use Levels, you can make the edge of the mask smaller, i.e., tighter around the object, by moving the black slider to the right. Conversely, the white slider will make the edge of the mask larger. This is something that has to be played around with to find the best results and, therefore, should be done on a copy of that layer - so you don't lose all of your hard work if it doesn't work out.

Here's another tip. To deal with the "halo", or glowing edge around the object: Hold CTRL (or OPT) and click on the mask to get the "marching ants", then Select > Invert the selection. At this point, you have the hidden parts of the image selected. Now, click on the image thumbnail, itself, so that you're working with it and not the mask, and, under Select > Modify, click Expand and choose one or two pixels, (could be more for a higher resolution image). You'll notice that the "ants" are, now, within the visible part of the image. Next, go to Image > Adjustments > Hue/Saturation and click where it says "Master" and choose the color(s) that appear in the "halo". Simply reduce the Saturation and/or Lightness until it looks right to you. For an image like the bird, you'd want to adjust both Cyan and Blue but, as always, each image will vary. You could, also, try to Colorize it to match it's new background. By selecting the mask and modifying it first, your adjustments don't affect the whole image - just the edge of the visible area (as well as all of the hidden area - another good reason to have applied the mask to a copy of the original layer).

Well, that's all, for now. I hope this can be helpful to you in your future endeavours!




All Content © BioRUST 2009 All Rights Reserved.