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:
- Select the layer with transparency
- 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):
- Open/create your image with 'baked in' transparency.
- Right click on the layer's icon in the Layers window and select Select Pixels.
- Layer menu -> Duplicate Layer
- Layer menu -> Merge Visible
- Repeat steps 3 and 4 several times until there are no semi-transparent pixels. The selection marquee should still remain.
- Layer menu -> Flatten image. You should see the transparency disappear. The selection marquee should still remain.
- Right click on the layer in the Layers window and select Layer from Background...
- Layer menu -> Layer mask -> Reveal Selection
- Done :-)
** EDIT - Nevermind, I see now that this is no better than the first response. **
This can be done in Photoshop.
- Duplicate Image
- Menu>Image>Adjustments>Curves
- 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"
- Menu>Image>Mode>Grayscale
- Flatten Image.
- Invert image. This is your mask.
- Select all
- Copy.
- Go back to your original image.
- Flatten image
- Unlock background
- Menu>Layer>Layer Mask>Reveal All
- Switch to the new channels palette and select the new mask channel.
- Click the "eye" to turn the mask view on.
- Paste
- click the eye to turn the mask view back off
- select the RGB channel again.
Done!
Note that if this is a common problem, it could easily be recorded as an action.
Easier way:
- Create a white color overlay on the image layer
- Create a black layer below the image
And now it should work!