Automated matting techniques

When you convert an antialiased selection to a layer, you sometimes take with you a few pixels from the selection's previous background. These fringe pixels can result in an unrealistic outline around your layer that cries out, "This image was edited by a hack." For example, Figure 12-12 shows a magnified detail from one of my original attempts to add a drop shadow to the TV. Although the selection outline was accurate, I managed to retain a few white pixels around the edges, as you can see around the outline of the picture tube and the arm that holds the tube.

Figure 12-12: This enlarged detail of the TV layer against the textured background shows the fringe pixels left over from the TV's original white background.

You can instruct Photoshop to replace the fringe pixels with colors from neighboring pixels by choosing Layer ^ Matting ^ Defringe. Enter the thickness of the perceived fringe in the Width option box to tell Photoshop which pixels you want to replace. To create the image shown in Figure 12-13, I entered a Width value of 1. But even at this low value, the effect is pretty significant, leaving gummy edges in its wake.

Figure 12-13: Here I used the Defringe command set to a Width value of 1 to replace the pixels around the perimeter of the layer with colors borrowed from neighboring pixels.

Photoshop provides two additional commands under the Layer ^ Matting submenu: Remove Black Matte and Remove White Matte. Frankly, it's unlikely you'll have much call to use them, but here's the scoop:

4 Remove Black Matte: This command removes the residue around the perimeter of a layer that was lifted from a black background.

4 Remove White Matte: This command removes a white ring around a layer.

Adobe tells me that these commands were designed for compositing a scene rendered in a 3D drawing program against a black or white background. But for other purposes, they almost never work. For example, my television is a prime candidate for Remove White Matte — it originated from a white background — and yet it leaves behind more white pixels than the Defringe command set to its lowest setting.

Tip If you encounter unrealistic edge pixels and the automatic matting commands don't solve your problem, you may be able to achieve better results by fixing the edges jF manually. First, switch to the layer that's giving you fits and Ctrl click its name in the Layers palette. This creates a tight selection around the contents of the layer. Then choose Select ^ Modify ^ Contract and enter the width of the fringe in the Contract By option box. Next, choose Select ^ Feather (Ctrl+Shift+D) and enter this same value in the Feather Radius option box. Finally, press Ctrl+Shift+I to inverse the selection and press Backspace to eliminate the edge pixels.

Figure 12-14 shows the results of applying this technique to my television. By setting the Contract and Feather commands to 1 pixel, I managed to remove the edges without harming the layer itself. And the effect looks better than that produced by the Defringe command (as you can compare for yourself with Figure 12-13).

Figure 12-14: Here I removed the edges manually using the Contract, Feather, and Inverse commands. This looks way better than anything Photoshop can do automatically.
Photoshop Secrets

Photoshop Secrets

Are You Frustrated Because Your Graphics Are Not Looking Professional? Have You Been Slaving Over Your Projects, But Find Yourself Not Getting What You Want From Your Generic Graphic Software? Well, youre about to learn some of the secrets and tips to enhance your images, photos and other projects that you are trying to create and make look professional.

Get My Free Ebook

Post a comment