PDA

View Full Version : What you can do with layer mask extraction techniques



StarControl
07-16-2009, 03:44 AM
SophT hinted that a tutorial on layer mask extraction would be a good thing. There are tutorials all over the internet and I'm not set up to do one of billpa's excellent video tutorials, so I'll point you to the tutorial I started with and try to give you a feel for the possibilities and why you might want to do layer masking.

To find a tutorial just google "layer mask extraction". I started with this one:
http://www.photoshopsupport.com/elements/tutorials/extract-hair/masking-tutorial.html

Layer masking is widely used in the ad industry as pretty much the only technique for isolating human hair from an image so you can imagine that it is a good option to consider anytime your logo has fine wispy elements, such as the hairline pen marks in the NBA Action logo below.

For our work in Hyperspin, it's also useful for separating out the component colors of an image from the background. Our images tend to have simple colors that should have uniform shading, but the vagaries of printing, scanning, and jpg compression end up mixing the colors along the borders. To clean this up, it is possible to use a layer mask to cut out a fresh layer of pixels to create an image element composed of nothing but the desired color and an alpha channel with absolutely none of the background color mixed in. In the NBA Action 98 logo below I used separate layer masks to extract the red text, black text, and blue highlights separately. I used those masks to cut out fresh layers of blue, black, and red pixels that had absolutely none of the white background mixed in with them. As a result, the image retains all the fine detail of the faint red strokes behind the letters and it looks perfect on both dark and light backgrounds.

One trick they don't mention in the tutorial above is picking a high contrast channel as the starting point for your mask. Typically one of the RGB channels will have better contrast for the element you are trying to pull. In the attached NBA Action 98 example, the red channel almost perfectly isolates the blue areas from the image (blue went to black and red and white both went to white).

Another example of this technique is the Scorcher logo. I was able to get the whole green grid extracted fairly quickly without lifting the pen tool once. The nice thing is that when you are creating a mask the goal is to get a black and white image to use against the original layer. This means you can do a lot of things to increase the contrast without having to worry about what it is doing to your original image. In this case I started with the green channel and then used curves to radically boost the contrast (but not so much that you destroy the antialiasing on your image's edges). That got me 90% of the way there in less than a minute and then I just used a black brush to paint out the remaining bits of background.

Another use for masking is font matching. Almost all of the font foundries on the web have some sort of method to try out their fonts on a sample of your text. This is perfect for us since we only need a few words. If you can find the right font then you can just type some of the logos in and push, pull, skew and scale them to fit. If you get your sample in black and white then it is already perfect to use as a layer mask. If you apply that mask to a solid color layer then you can get the text in any color you choose with a perfect alpha channel that can be overlaid against any background with just a few clicks. You can also get fancy and apply it against a gradient to duplicate some of the shiny effects.

Darklight Conflict is an example of using both the pen tool and layer mask extraction. The word "darklight" was easiest done with the pen because of contrast issues, but the word "conflict" had such high contrast against the background that it was a snap to to turn it into a mask and use it against a gradient layer to get perfect free floating text in just minutes. Discworld is an example of a logo extraction made easy with layer masks. That one took just minutes to do, and it has perfect separation from the original background and the little bit of color fringing in the original completely vanishes using this technique.

Layer masking is a powerful addition to your arsenal when extracting wheel or character art. It is a perfect complement to the pen. It is good for fine details and fuzzy stuff and contrasty stuff and the pen is absolutely necessary for low contrast stuff and still produces the cleanest lines on your large image elements.