Make the background of photo/image transparent in photoshop while preserving shadows.

Published in Design

transluescent shadow background

One of the most common things I have to do in photoshop is the delete a background from a product shot or photo without deleting the shadow. I do this any time I take a product shot on white. Usually I remake the shadow myself because I can do it cleaner and I can simulate advance lighting this way.

At the end of the day I still have to "peel" the background off an image and make it transparent. Unlike clear cutting (or deep etching if your Australian), I need to make the background transparent but preserve other information (like the shadow). Preserving the shadow on the background isn't that hard if you know how.

There are two ways to do this and the method you choose will depend on WHY you need the background to be transparent.

Note: This tutorial asumes a basic knowledge of Photoshop.

If you will want to delete the background in order to output as a gif or png for the web. Use my second method. Due to Photoshop limitations, you can't simply merge a multiplied layer to get an alpha channel (transparent channel) the way you would want it. This is the most correct solution for making a background transparent because it creates a "normal" layer for the shadow (i.e. a layer with the shadow on it that isn't special in any way).

The faster way (if you don't need to make a PNG or output the file with transparency) is to use my first method. Method two is the one to choose if you need to make a PNG file with a translucent background.

Method One: Making a background transparent without deleting shadows to overlay other images in Photoshop

  1. With your file open in Photoshop, Ensure the layer you want to have as a transparent background is a floating layer and not the "background". To do this, check the layers palet, if the layer you want to work with is called background, double click it and give it a name. When you click ok it will no longer be locked and instead will become a floating layer.
  2. Drag this layer onto the new layer icon to duplicate the layer.
  3. In the new layer, work with you favourite tools to DELETE the shadows from around the objects. You should turn off the bottom layer so you can see what you're doing. I simply use a combination of the eraser tool and selecting areas to delete with the selection tools and quick-mask. What you should be left with is your object without any shadow.
  4. Now that you have your objects separated from their shadows. You should have two layers left one is the object and one is the shadow. I quite often remake the shadow layer by creating a new layer and painting a new shadow with a soft brush.
  5. Now you can simply copy and paste both layers into any image in photoshop and set the layer with the shadow to a multiply layer. This will allow the shadow to blend witha any layers underneath. The object on the layer above will remain opaque (solid).

NOTE: This method does not separate the shadows for exporting to web or creating file which preserve the transparency. If you want to turn the background of a photo or image into a transparent background in photoshop while preserving shadows, you will need the next method:

Method two: A creating a translucent shadow

If you have to "peel" a white background off an image, this method is much cleaner than using the magic wand, as the magic wand often leaves either a halo or a jagged/untidy edge.

  1. Open your image and double click the word "background" in the layer palet to change the background layer to a floating layer.
  2. Make a copy of that layer and INVERT the new layer (image-sdjustments-invert)
  3. Select all (cmd+A) and copy (cmd+c) the inverted layer into the clipboard, and switch off its visibilty for now
  4. Go back the first layer and create a layer mask
  5. With the first layer selected, click on the channels tab and click to select the channel named "mask"
  6. Click back to the layer tab and press paste (note, as Bronius points out in the comments, you should hold alt/option and click the layer mask in PS CS6 or above). The inverted image will be pasted into the layer mask.
  7. If you find the shadow is too light, duplicate this new layer until necessary (5 times?)
  8. Merge down the layers one by one (Ctrl-E) choosing to "apply mask" each time
  9. Make the inverted layer visible again and then invert it back to normal
  10. Delete all the background from around the object.

You should now have two layers. The first layer contains an opaque (solid) foreground and the layer underneath which is a normal opaque layer with a translucent shadow. This means you can now you the photoshop "save for web and devices" from the file menu, choose png as the file format and use the resulting PNG file for whatever you desire.