What's new

Transparancy and Alpha Channels


Erik

Guru
Messages
1,534
Likes
2
I just come from TG, and noticed that there are people who have problems with transparancy and alpha channels: someone wrote that having an alpha channel is enough to get transparancy...???

A channel is a container for specific information concerning your file/image. Example: the Red Channel contains all information about what's red in your image. An Alpha Channel contains information that you, or someone else added to the file. When working for print (not your desktop printer!), you can add for example spot colours. These are colours made of separately mixed inks (most often Pantone) that broaden the narrow possibilities of CMYK, and are mostly used flat. . More on this another time.
You can also use Alpha Channels to save a selection. You know that a selection means that you want to do something with certain selected pixels and not with others that you did not select. The pixels that you did not select are masked. You can easily see this on the Tools palette when you click the Quickmask button. Masks are in fact greyscale images and therefore they can be stored in a container, the Alpha Channel container. So what you do is make a selection and then save that selection ( Select>Save). This way it is stored as a mask in the Alpha Channel. You can see this in the Channels Palette.
This way, when you save your file/image, you save the selection with it for later re-use. Handy, isn't it?
But what has this got to do with transparancy you may well ask.

A mask in an Alpha Channel in itself does nothing. When you activate it, you will only see what is masked and what not.

To get real and easy-go transparancy, you first turn your background into a layer by double clicking on Background in the layers Palette. Then you make a selection, indicating that you want to preserve these pixels and get rid of the others.
Next you click the little icon at the bottom of the Layers Palette that says " Add Layer Mask" and bingo!.

Fun thing is that you now also have an Alpha Channel in your Channels Palette, called LayerO Mask, or whatever yo named it. But this one does really make unselected portions transparant. But, because it's a layer, not a flattened image, you can't save in all formats. PSD is Photoshop's native one, and is the more interesting. You can also save as advanced tif. PS7 does this automatically, PS6 wants you to change its preferences.

(You can see what you do when you want to work on this mask by alt clicking clicking the mask icon. When you simply click, you see the small mask icon instead of the brush, indicating you work on the mask. Like this you can see what you do to the image itself.

Of course, you can soften your selection etc etc before you make a mask out of it, and you can paint in a mask to make a more perfect selection.)

Of course, for the web you need gif or png to get transparancy.
 

Greg

Member
Messages
5
Likes
0
Nice overview Erik,

One clarification though so people don't misunderstand.

A mask in an Alpha Channel in itself does nothing. When you activate it, you will only see what is masked and what not.
A Layer mask is an Alpha channel, just a special one that is applied as "live" transparency/opacity on the layer it is attached to. If you have a Layer Mask attached to an image and go into Channels you will see it listed there with italic type. This indicates that it is not a "normal" Alpha channel.

So the quote above is accurate but it excludes the fact that PS uses channels in the case of a Layer Mask to handle information that is applied live to the image. When you edit a Layer Mask via the Layers Palette you are essentially painting on a special Alpha channel with a live hook to the active layer.

btw: trivia question, any of you folks know who invented the Alpha Channel?

Greg
 

Erik

Guru
Messages
1,534
Likes
2
And that's what makes the difference: the more you have mastered something, the better and more complete you can explain it.
You're right (of course!) about the italic text.
 

AppleCider

Power User
Messages
400
Likes
2
I really hope new Photoshop users pay attention to this thread...alpha channels, and channels themselves, are the hardest thing to get your mind around. But once you do, you can do some very powerful stuff.

The thing that gave me the "aha!" moment was when I selected something (years ago, I don't remember what it was now) and it was a complex selection...I agonized over it with the lasso tool. And gawd knows, I didn't want to do it AGAIN! Fooled around, found "save selection" and there was "into a new alpha channel" Suddenly, it made sense! I'm saving pixel information into the file that's separate (but related) from color information. Once you wrap your mind around that one, the rest follows. If you're like me, slowly but surely <grin> Then comes the knowledge that you can do almost anything with an alpha channel that you can do on the image itself...run filters, do most adjustments...Levels is real useful here, fill with colors (as long as they're black, white, or shades of grey) and those changes will reflect on your image...sometimes in unexpected ways!
 

Erik

Guru
Messages
1,534
Likes
2
To illustrate the difference between the two:

1/Open a new file, add some text and rasterize the type layer. You will notice that it is a separate layer that is fully transparant except for the text you wrote on it.
2/With this text layer active, press Ctrl/Cmd A to select all and then Q (or shiftQ, depending on your preferences). Nothing happens, visibly, but you're in quickmask mode now.
3/Take the gradient tool and drag a gradient from white to black from right to left. You will see a mask appear.
4/Press ShiftQ again and see how your selection has changed (selections never show partial transparancy, in this case the transp. is in the mask of course).
5/Apply any filter. I chose motion blur set at 5 pixels. This blurrs your text a bit.

6/ Ctrl/Cmd Q to go back to quick mask
Ctrl/Cmd L to open the levels dialog box and drag the central (gamma) triangle until the central number is .50
7/ Ctrl/Cmd Q again to go to normal made. You selection got narrower
8/ Ctrl/Cmd F to apply the same filter with the same settings

Repeat steps 6 to 8 another two times.
What happens is that the mask protects larger and larger portions, increases its influence, so you apply more and more blur to a smaller and smaller region. This gives you a progressive blur.
 

Erik

Guru
Messages
1,534
Likes
2
When you start from the same text, rasterised, and on its own layer, you can add a layer mask (see illustration). Click on the eye icon of the background to make it temporarily invisible.
When this layer mask is active (see ill) and you add the same gradient here, you notice that it adds gradual transparancy.
When you now make the background back visible, you see how the text now fades away.

Yes, there are other options, like adjustment layers etc, but these two are imo of vital importance to work/play in PS.

Both are masks, and both are infact greyscale images to which you can apply filters, gradients etc etc. But a layer mask shows and/or hides portions of whatever you placed on the layer, while a "normal" mask allows you to refine your selection, and thus the area on which you want to work.
 

Top