Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GIMP and alpha channel

7 views
Skip to first unread message

Marcin Kalicinski

unread,
Nov 16, 2005, 5:59:33 PM11/16/05
to
Does GIMP treat alpha channel as any other channel (i.e. you can paint on
it, draw text on it, copy from it, paste to it, view it etc.), or does it do
all the horrible mess of treating it as a second class citizen, as most
other image programs do?


stus...@hotmail.com

unread,
Nov 16, 2005, 6:50:11 PM11/16/05
to
yes, Alpha is well supported by Gimp

Spamless

unread,
Nov 16, 2005, 9:07:16 PM11/16/05
to

Yes and no. As the plain alpha channel you use alpha commands (fade plugin,
etc.). But ... select a layer. In the layer tab right click on the layer
and choose to transfer the alpha channel to a layer mask (add layer mask and
in the next dialog in later versions of gimp, transfer the alpha channel).

On the layer tab there will be two mini-images. The one with a white border
is the one on which you work. Click one of the other to choose what you work
on. The one on the left are the layer's channels. The one on the right is
the layer mask. If you click the layer mask, you have a single channel (just
grayscale) layer. White is opaque. Black is transparent. And gray is ...
(so, for example, to make a layer smoothly vanish as you travel down the
screen simply choose the layer mask on which to work and put in a linear
gradient from white to black on the layer mask). You can use any of the
drawing tools on this layer, for example, if you have used some fade plugin
which fades an image out linearly and would like a softer blend to the
background, transfer the alpha channel to a layer mask, select the layer
mask, with it selected use LAYER->colors->curves and change from a linear to
something else (put a tail at the dark end and a shoulder at the top, for
example).

Some filters (e.g. Script-Fu -> selection -> fade-outline) use layer masks
and as you can have only one on a layer, you can apply the layer mask to the
layer (move it back into the alpha channel).

You can have a layer mask and alpha channel (they combine so you can use the
layer mask to affect part of the alpha effect).

I find it easiest to transfer the alpha channel to a separate item (layer
mask), work on it, and apply it again (move it back to the alpha channel).

Want a stencil effect (viewing a background through cut out text on an
image)? Text layer with the black text. Put this on/over an image sized
white layer and merge them (to create a black text on white background
layer). Now if that were the layer mask ... so ...

Add layer mask on which you want a stencil (to cut out the text - as
we are going to copy the text to it, you can simply make this white).

Select the white layer with black text. Select all. Cut. Select the
layer mask on the image for which you want the stencil effect. Paste.
It is a floating layer, so anchor it. Now you can delete the empty
(due to the cut) text (black on white) layer and (if you want to move
the stencil effect to the alpha channel) apply the layer mask. The trick
is simply to have black on white (with gray for partial transparency) and
use that as a layer mask (copy paste, use any drawing tools, etc.).

Marcin Kalicinski

unread,
Nov 17, 2005, 8:51:00 AM11/17/05
to
Ok, thanks for the info! I still got two questions:
- I have tried hard but I cannot see the alpha channel/mask alone (i.e.
alpha-channel image in shades of gray). How do I see the alpha channel
without color channels?
- why is there a mask and an alpha channel? I think it is a redundancy that
vastly complicates use of the transparency and makes it require a PhD to
understand what's really going on. I can select red, green or blue channel
and see/paint exclusively on them. Why I cannot simply do the same with
alpha channel, instead I have to create the "mask"?


Spamless

unread,
Nov 17, 2005, 11:30:59 AM11/17/05
to
On 2005-11-17, Marcin Kalicinski <kal...@poczta.onet.pl> wrote:
> Ok, thanks for the info! I still got two questions:
> - I have tried hard but I cannot see the alpha channel/mask alone (i.e.
> alpha-channel image in shades of gray). How do I see the alpha channel
> without color channels?

Well, it has no color to it? What would you expect to see? :-)

If you transfer the alpha channel to a layer mask, right click
the thumbnail of the layer mask and choose to "show layer mask".
That will give you the alpha channel as a gray scale image.

> - why is there a mask and an alpha channel? I think it is a redundancy that
> vastly complicates use of the transparency and makes it require a PhD to
> understand what's really going on. I can select red, green or blue channel
> and see/paint exclusively on them. Why I cannot simply do the same with
> alpha channel, instead I have to create the "mask"?

You can use the eraser tool, setting to erase or anti-erase, and paint
over the alpha channel with it (adding or removing transparency).
Redundancy? Gimp is full of redundancy. There are many, many ways one can
get the same, or very similar, effects.

Modify the alpha channel directly? You can, using scripts (working on the
alpha channel). But it has no color to show you any pixels. By transferring
to a layer mask (now it is transferred to a visible "layer" with white,
gray, black pixels), and there IS an option to show the layer mask (to make
it visible as a white/black layer but, unfortuntately, I don't immediately
see a way to show the layer mask -partially transparent- and the image
underneath to make it easy, like the quickmask, to make selections based on
the image - there is a way around that. Duplicate the layer. On the top
copy, reduce its transparency to, say 50%. Work on the bottom copy. There,
choose to show the layer mask. You view it through the partially transparent
top layer so you can see what you are doing and the image - when done,
delete the top layer and apply the layer mask to the bottom, working layer -
of course you can always use a quickmask, cut and copy that to a layer mask
(or transfer to a selection and CLEAR the selection, but that will make the
white/solid transparent while applying copying to a layer mask will make the
white/solid opaque).

If you have GimpUsersManual_SecondEdition-PDF.pdf there is a section there
on using channels to store selections (alpha channels) (when making a
selection one can choose to store it in a channel, etc.) and choose to (on
the channels tab, right clicking on the channel) convert a channel to a
selection, choose a layer, and, say, erase (clear). That erases solids
completely, clear parts of the channel not at all, in intermediate values
partially, i.e. it applies the selection to the alpha channel (which is what
clearing/erasing does). Try adding a quick mask and then checking the
channels tab - it adds a new channel (whose values one can then apply to the
alpha channel by changing it to a selection and erasing it). Here is another
way of fading out an image from top to bottom. Quick mask. On the quick mask
put in a black to white gradient from top to bottom (black at the top since
were are going to erase this and black will mark parts not erased). Channel
tab, change channel to selection. Select the image layer. Now you have a
selection using a gradient. Use CTRL-K to clear it. Personally I would use a
layer mask and put in a gradient from white to black and apply it (instead
of a quick mask, black to white gradient, apply as a selection and clear it)
(of course you could put the gradient on a quick mask and copy and paste
that to a layer mask!). For a stencil effect, instead of putting text
(black) on an opaque (white) layer mask, one could put the text on a new
channel, convert the channel to a selection and clear (erase) it to get the
stencil effect. Not to mention creating a text layer, using ALPHA to
SELECTION (to convert the text to a selection region), switching to the
target layer and using clear (CTRL-K) to create a stencil (hole) in the
image for the letters (that is probably the easiest).

So ... you can use a "selection" mask (a new channel), convert to selection
and clear/erase to apply anything to the alpha channel or work on a layer
mask and apply that to a layer. Using channels keeps the selections separate
from the layer (layer masks are linked to the layer, but you can copy and
paste to the layer mask for a different layer). Or write a script to modify
the alpha channel directly (or use a plugin, such as
script_fu->feather->fade_outline, to do it for you if you find a plugin that
does what you want).

There are many ways to do the same thing in gimp. It can get confusing.
But if you can find one way to do what you want - that's all you need.

I'm no expert on using gimp, but I generally can find at least one (and
often more than I want!) ways to get what I want done. Often what I find
is not the easiest way :-(

Marc 'BlackJack' Rintsch

unread,
Nov 17, 2005, 5:25:45 PM11/17/05
to
In <8V%ef.15888$wh7....@newsfe2-gui.ntli.net>, Marcin Kalicinski wrote:

> Ok, thanks for the info! I still got two questions:
> - I have tried hard but I cannot see the alpha channel/mask alone (i.e.
> alpha-channel image in shades of gray). How do I see the alpha channel
> without color channels?

In the context menu of the layer dialog you can select `show layermask`.
Then you will see a the mask as grayscale picture instead of the layer
image.

Ciao,
Marc 'BlackJack' Rintsch

0 new messages