You probably experience this on a regular basis: a client sends you an illustration or a logo they’d like to use in a project, but it’s a low-res bitmap or a flat image file with a background texture. Or both, if you’re really lucky. Sure, you can try and ask for a vector version, but more often than not what they originally sent was the best copy they had on hand.
I seem to have made something of a hobby out of trying to coax useful results out of this type of file. Over the years I’ve stumbled across far better ways of doing it than manually clipping the background with the the magic wand or various selection tools.
For the next time you’re handed a less-than-ideal source image, here are a few of my tricks for isolating the part of the file I want to work with in Photoshop.
I’ll use this Firefox promo image as an example. Yeah, I know I can find a vector version of this particular logo online, but it makes for a fairly good demo thanks to the complexity of the background.
Let’s start with the text. A single, flat colour ends up being fairly easy to extract. The first step is using the Hue/Saturation sliders [Ctrl / Cmd + U] to drop the saturation all the way down to a value of -100:
Then trim away the surrounding pixels to focus on the area you want:
Next use the levels sliders [Ctrl / Cmd + L] to increase the contrast on either side so that the background is black and the text is white. The trick is doing it in a way that doesn’t completely kill the anti-aliasing between the text and the background, while at the same time making sure the foreground/background colours are pure black and white. You don’t want stray pixels on either side, otherwise nasty things will happen later on when you try using your results. If you just can’t find a balance, use the brush tool to fill in the strays manually.
The best results come from images where the text is clearly a different shade than the background behind it. In this case it is, so I’m able to get a reasonably high-contrast result:
At this point you have two choices. If you don’t need the ability to change the colour of the text or apply layer effects, you can stop now and set the layer’s blending mode to Screen or invert it (Ctrl / Cmd + I) and set the mode to Multiply. With the either of those blend modes you should be able to place this high-contrast layer over top of a background and it’ll be treated as isolated text. The key being placing it on top of non-transparent background; if there are no pixels beneath for the layer to blend with, you won’t be able to save it out the same way it renders in Photoshop.
For that extra control you need to take it further. By holding down Ctrl / Cmd and clicking on the image’s layer in the Layers palette you can select just the outline; copy that to the clipboard, open the Channels palette, create a new Channel, and then paste the clipboard into that channel. If you’ve done it right it should look something like this:
The same way you selected the outline of the image in the Layers palette, you can Ctrl / Cmd + click in the Channels palette and the selection will change to just the border between the background and foreground. If you switch back to the Layers palette and create a new Solid Color fill layer:
The text now sits on an isolated layer that allows you to easily change the colour, apply layer effects, etc.
The icon is more complicated. We’ve got a strong orange foreground, but the globe and the background share some tones so extracting is going to be trickier. This is a fairly common scenario in the wild, but the good news is that it’s still doable in most cases.
Let’s be a little more selective about what we’re trying extract this time. Start by focusing on the orange fox for now, we’ll come back for the globe. The Select > Color Range tool allows you to click an area and select all colours similar to that selection point, and the Fuzziness slider controls how loosely or tightly the selection matches that colour. Selecting the blue area instead of the orange produces a much higher-contrast outline of the orange area:
Once you hit okay you’re left with marching ants. The selection isn’t useful yet, so back to the Channels palette we go. Create a new alpha channel and fill the selection with white:
Now you can just pull up the Levels palette and, with the same high-contrast result in mind as the previous text example, adjust the levels until the fox is pure black and the background is as pure white as you can make it:
If you hit Ctrl / Cmd + click on the channel then head back to the Layers palette and select the original, you can click the Add Layer Mask button in the bottom of the palette and have the selection mask the image to just the orange areas we’ve managed to extract:
If you end up with too many fringe pixels from the background, you can hit Ctrl / Cmd + select the mask again, and use the Select > Modify > Contract tool to decrease the selection 1px on all sides. Invert this smaller selection with Ctrl / Cmd + Shift + I, then select and fill with black the layer mask to apply it. This will eat up a one pixel outline around the object, which should take care of the fringe without tossing out too much image data. Though it does depend on the size of the source image.
We now want to add the globe back in, so duplicate the layer and remove the mask to show the original image again. Manually trace the outline of the globe with the circular marquee tool, select the masked layer and fill that selection with white within the mask. And there we go, an isolated version of the Firefox icon that you can manipulate as you please:
Extraction this way seems like a lot of work, but once you get the hang of it you’ll find it’s fairly quick work to go from a source image to something usable.
For relatively simple jobs like the text, the process is straightforward and can be done in a couple of seconds. For more complicated extraction as in the case of the icon, creative alpha masking combined with a bit of manual tweaking will usually get the job done.
(And I don’t have to remind you to always use this for good and never for evil, do I?)