Mon, 24 Feb 1997

How to create masks with Magic Wand tools

By Zatni Arbi

JAKARTA (JP): In the world of computer-graphics design, the mask is as important and essential a tool as it is in the world of politics.

In CorelPHOTO-PAINT, Adobe Photoshop and other graphics image editing programs, the masks are perhaps one of the most essential tools for manipulating images. Take a look at the accompanying picture. If you have The Jakarta Post's beautiful 1997 wall calendar, you'll recognize immediately that the picture at the bottom is of a Sumatran Tiger, skillfully captured by P.J. Leo for the month of January.

Across the top of this particular picture you'll see a board painted in yellow and green and you can read The Jakarta Post's banner -- complete with its subtitle. The portion of the picture behind the board still shows through the text, as if the text had been punched through the board. The board is a mask.

For a change, let's explore the possibility of creating this effect with Photoshop, the de facto standard program for hard- core professionals in graphics editing. CorelPHOTO-PAINT lovers don't have to worry because almost all of what we do here can also be accomplished in CorelPHOTO-PAINT.

The project

To simplify the accounts of the procedure, let me provide you with step-by-step details of what I did to create the composite image in the illustration.

First, I used a scanner to scan the image of the Post's banner. Because the banner extends across the top of the page, I had to scan it vertically. More importantly, because the image was basically a black and white one, I scanned it as a black and white drawing. This eliminated the task of cleaning all the dusts and ink spot that may have been splattered around the characters. I chose the .TIF file format before I saved the file, but you can choose any other popular format for the image.

Next, I opened the file in Photoshop 4.0. I clicked on Image, and then Rotate Canvas. I rotated it 90 degrees CCW (counter- clockwise) as necessary. Then I selected the Magic Wand tool from Photoshop Toolbox. Photoshop had a different approach to shortcuts. If I chose, I could have just hit the W key once to select it. In the accompanying picture, the Magic Wand is the tool underneath the mouse pointer. As I moved the cursor over the image, its shape changed into a wand that magicians use in their shows. Then I selected all the areas in the banner that were white by placing the cursor anywhere outside the black text and clicking once.

Spots

What the Magic Wand tool does is select pixels of the same color that are adjacent to each other. We can increase or decrease the range of colors that the wand is supposed to select. In Photoshop, the range is between one and 255. A tolerance level of one will select pixels that have exactly the same color value. The higher the tolerance level, the wider the range of the colors of the pixels that get selected.

However, there were spots in the banner that did not get selected because they were isolated from the main white area by the black text. In the example, you would find these spots inside the characters e, a and o. To solve the problem, I just told Photoshop to look for these insular areas and add them to the selection mask. To do this, I clicked on Select and then Similar. Every white pixel in the image was now included in the mask.

We can do a lot of things to the masked area of an image. For instance, we can change its fill color, punch it out to make it 100 percent transparent, or save it for reuse at a later time. In this project, I just copied the mask by pressing Ctrl-Ins (or clicking on Edit, Copy).

My next step was to scan the picture of this animal's handsome head and opened it in Photoshop. I then pasted the mask that I had just copied on top of the newly opened image. This created a new layer on top of the background, and the Layer Palette on the bottom right-hand corner identified it as Layer 1. Because I had copied only the white area of the newspaper's banner, the black text was not copied. It gave an effect as if they were carved out of the mask.

As usually happens, the mask may be too large or too small. Rarely will it fit the entire image. The best way to solve this problem is to go back to the original banner and have Photoshop resample the image to reduce or enlarge the size as necessary. I clicked on Image, and Image Size. On the dialog box that appeared, I increased or decreased the dimensions as needed. What you must remember is that the ratio between the image width and height should be maintained. The easiest way to ensure this is to check the Proportions option.

After I resized the image of the banner and Photoshop finished resampling it, I had to use the Magic Wand tool once again to select all the white areas. Then I copied the mask to the clipboard and pasted it on the picture of the tiger like before. Usually, the copied mask lands in the center, so I used the Move tool to drag it to the top of the picture. In Photoshop, we just have to hit the V letter to select this Move tool.

Once the mask was positioned in the right place, I could turn the white color into any other color. In this example, I changed it to a light yellow color. I clicked once on the Foreground color box at the bottom of Photoshop toolbox. This brought up the Color Picker dialog box. I chose the color I wanted, and closed the box. Then I selected the mask once again with the help of Magic Wand. I then clicked on Edit, and then Fill. On the Fill dialog box, I made sure that the chosen fill color was also the Foreground color and the Opacity level was 100 percent. Then I hit Enter. The mask now was in yellow.

Finishing touch

In Photoshop, we can do more magic tricks with the mask tool. For example, we can stretch the selection out or shrink it. In the pictured illustration, I've given the mask a rim. I created the rim by taking advantage of Photoshop's ability to shrink an existing selection.

First, I selected the mask once again with the Magic Wand tool. When I saw the selection marquee around it, I clicked on Select, Modify and then Contract. Photoshop allows us to expand or shrink a selection as much as 16 pixels at a time. I chose the maximum, and the marquee now became smaller than the mask. I changed the foreground color in the box into green, and then clicked on Edit and Fill again to fill the shrunk selected area. The result is as you see in the picture.

Remember that you can copy as many masks as you wish onto a single image. Each time it will create a new layer. These individual layers will remain separate until you combine them with the background. Once you do that, you won't be able to manipulate the mask in isolation. So, do what you want to do before you merge the layers together.