Tuesday, April 26, 2011

Digital Backgrounds? Ditch the Green, and go Gray!

One of the big benefits of digital editing of images is the ability to use "digital backgrounds" -- putting a subject in a scene completely different from the one you used when you took the image. The "standard" way to do this is to use a bright green or blue "chroma-key" backdrop when you shoot your subject, then replace the green-screen background with another image later on. The problem? Green is, well, *green.* It's easy for software to pick it out from your subject, but even with the most careful lighting some green nearly always bleeds onto or reflects from your subject, leaving green-edged artifacts in the final composite that can take hours to edit out. My solution? Ditch the green -- and go gray.

I came up with this technique when I first started doing high school senior portraits. My local high school has a required "standard" background for the shots that will go into the yearbook, a gray-striped muslin, so the senior images all have a consistent look. While that background is fine for the yearbook, I found that most students and parents weren't exactly thrilled with it for shots they wanted to purchase (one student called it "so 70's"). So to make my clients happy, make more sales, and still give the school yearbook what they wanted, I needed a way to easily change backgrounds without hours of editing work. Enter the gray screen.

The technique is simple: shoot the original image in front of a medium-gray, plain backdrop, evenly lit. The image above is the original studio shot that I'll be working with for this example. The backdrop is a roll of seamless paper from Adorama. Adjust the portrait lighting using hair and/or edge lights so that there is good separation between the subject and the background. Once the image is done, open it in Photoshop, and follow the steps below:

1. With the image open, duplicate the background layer (on a PC, right-click the background layer, and select "Duplicate Layer" from the pop-up menu).
2. Select the Magic Wand tool from the Photoshop tool bar; set the "Tolerance" setting to about 10-14, and check the "Anti-Alias" checkbox.
3. Click in the gray background area of the image, and the magic wand will select areas of matching color -- just the gray background. The more evenly lit your gray background is, the more the wand will select with each click. Click around in un-selected areas until all of the gray background is selected. Pay close attention to edges of faces and hair, to make sure the selection goes right up to the edge. This typically takes me about 30 seconds to select all of the background.

4. Your selection should now look about like it does in the image above. With the selection done, soften it up just a little bit: Go to the menu Select->Modify->Expand, and enter a value of 2 pixels. Then to go the menu Select->Modify->Feather, and enter a value of 2 pixels again.
5. Finally, go back to the layer palette, and with the duplicate background layer selected, alt-click on the Layer Mask icon at the bottom to create a layer mask that looks like the one in the image below -- white to show the subject, and black to hide the gray background.

That's it! What you now have is a top layer for your image with a layer mask that will show the subject from that layer, but will hide the gray background. Anything you put *under* that layer (currently what's under it is the same image as the "background") will now show through where the gray background is, and replace it.
One big reason for using gray instead of green is that a medium-gray background will allow you to use blending modes for the replacement background that you can't use with a "green screen." For example, to drop in the standard yearbook background, I open the background image, select the entire image, copy it, and then paste it into the portrait image as a new layer between the background and my masked duplicate above.

Your layers palette should now look like the image above: original image on the bottom, new background in the middle, and masked duplicate of the original on top.
Now set the blending mode of the yearbook background to "overlay" instead of "normal" -- overlay mode combines the current image with the one(s) below it; where the overlay image is darker than middle gray, the combination will be darker. And where it's lighter than middle gray, the combination will be lighter. So instead of *replacing* a green-screen background, a gray background allows you to BLEND the new background in with the old one, which gives a smoother, more natural-looking replacement and no edge artifacts. Here's a close-up view of how the overlay blending mode looks on the very detailed hair of the subject in this image:

Notice the smooth blending between the foreground hair, the middle layer striped muslin, and the original gray background -- no artifacts, no rough edges, just a smooth and easy blend. With just 30 seconds of clicking to make a mask! That's why gray is better than green. The full image looks like this:

Having tried this a number of times with "green-screen" backdrops, and never being able to completely get rid of green-edge artifacts, I can assure you that the gray way is much, much easier -- and gives better results as well.

Once you have your masked image "sandwich" done, save it off as a PSD file to keep the layers intact, and then if your clients want to see different backgrounds for their images, you can load them up and show them to them in real time simply by replacing the middle layer background with other images. A good example is the sunset beach picture here, which I shot in Hawaii. Putting this in required nothing more than replacing the gray yearbook background with the Hawaii picture -- the blend mode is still set to "overlay," and because of the original middle gray color of the image it blends perfectly with the replaced background.
You can experiment with all sorts of layer combinations and blending modes for your drop-in backgrounds, all with little or no tedious editing of the top image mask, and smooth blending of whatever you stick in between them. I often will use the yearbook background image for the muslin-stripe pattern, but then add another layer on top of that one in "color" mode, then freehand draw some colors there to change the striped muslin from gray to blue, or red, or anything else. Let your imagination run wild!
Using a gray background turns out to be much easier than traditional "green-screen" background replacement, doesn't require nearly as much tedious editing to get rid of green-edge artifacts, and opens up many more options for use of blending modes to do interesting things with your backgrounds. All with just a few clicks of the magic wand tool. Give it a try!

Related Articles:
Make Your Own Digital Drape Backgrounds


  1. hi and thank you for agreeing to the link exchange. been having vpn troubles this week, unable to access my typepad account. really sorry about that. :(

    i just finished updating my blogroll with a link to your great blog.

    talk to you later
    your friend

  2. This was very informative. Thank you!

  3. Hi! Very nice tutorial! Do you mind if I post it to ? I wanted to private message you but can't find a contact link...?

  4. Now all you need is to add some digital backgrounds to your excellent advice! has lot's of free sample backgrounds they are giving away!

  5. @Anonymous: "Free Samples There are no products in this category."

  6. Hi; your advice is good; but application a bit rusty;if you are lighting a subject from above ; you cannot see the sun or sunset.... if the sun is above your left shoulder make sure the shadows fall within the same vector..