Extracting the layer transparency into an editable layer mask in Photoshop

Is there any simple way to extract the "baked in" transparency in a layer and turn it into a layer mask in Photoshop? To take a simple example: Let's say that I paint a few strokes with a semi-transparent brush, or paste in a .png-file with an alpha channel. The rgb color values and the alpha value for each pixel are now all contained in the layer-image itself. I would like to be able to edit the alpha values as a layer mask, so that the layer image is solid and contains only the RGB values for each pixel.

Is this possible, and in that case how? Thanks.

EDIT: To clarify - I'm not really after the transparency values in themselves, but in the separation of rgb values and alpha values. That means that the layer must become a solid, opaque image with a mask.


This is what I do:

  1. Select the layer with transparency
  2. Click on Menu item Layer, Layer Mask, From Transparency.

The transparency will be converted into a layer mask, that you can manipulate from there.

EDIT: in Photoshop CS5 or later.


I have improved Mike's solution (Photoshop CS3):

  1. Open/create your image with 'baked in' transparency.
  2. Right click on the layer's icon in the Layers window and select Select Pixels.
  3. Layer menu -> Duplicate Layer
  4. Layer menu -> Merge Visible
  5. Repeat steps 3 and 4 several times until there are no semi-transparent pixels. The selection marquee should still remain.
  6. Layer menu -> Flatten image. You should see the transparency disappear. The selection marquee should still remain.
  7. Right click on the layer in the Layers window and select Layer from Background...
  8. Layer menu -> Layer mask -> Reveal Selection
  9. Done :-)

** EDIT - Nevermind, I see now that this is no better than the first response. **

This can be done in Photoshop.

  1. Duplicate Image
  2. Menu>Image>Adjustments>Curves
  3. Grab the top right corner of the curve and drag it to the bottom right corner- Input 255 should read output 0. This is the inverse of your transparency mask. Click "OK"
  4. Menu>Image>Mode>Grayscale
  5. Flatten Image.
  6. Invert image. This is your mask.
  7. Select all
  8. Copy.
  9. Go back to your original image.
  10. Flatten image
  11. Unlock background
  12. Menu>Layer>Layer Mask>Reveal All
  13. Switch to the new channels palette and select the new mask channel.
  14. Click the "eye" to turn the mask view on.
  15. Paste
  16. click the eye to turn the mask view back off
  17. select the RGB channel again.

Done!

Note that if this is a common problem, it could easily be recorded as an action.


Easier way:

  1. Create a white color overlay on the image layer
  2. Create a black layer below the image

And now it should work!