Jean-Christophe Dubacq <[EMAIL PROTECTED]> wrote:

>Is there any way to directly edit the alpha layer of a layer. Layer
>masks do only reduce the alpha, never increase it; and sometimes I would
>like to somehow delete any opacity information in a layer, without
>having to repaint all. So maybe there is a solution, but I didn't find
>this (since editing a mask is not the answer)...

Seems that what you want to do is better done with a layer mask, as you've
already been explained. But if you already have the alpha channel and want
to convert it to a mask, I can offer you two solutions:

1. Follow these steps:

- Create a layer mask using the layer's alpha channel as source.
- Use <image>/Layer/Threshold Alpha with a setting of zero to bring back all
not-purely-transparent pixels to full opacity.
- If necessary, fill the remaining purely transparent parts with a color of
your choice, since according to the logic of the designers of the program
they conceptually have no color at all. You can use Alpha to Selection
(saving your previous selection to a channel if you had one), then Invert
Selection, then Fill with FG/BG, then Select None to accomplish this.
- Edit the mask at will. You'd better not keep on using the alpha channel at
all, as it's not what the designers of The GIMP think it's for; however, if
you save to PNG you will have to apply the mask and follow the above steps
to recover it again later.

Easy, huh? Well, that's how the zero-alpha "feature" works.

2. Copy the following script (which uses an undocumented hack and may cease
to work in future versions) to <your home dir>/.gimp-1.3/scripts/

  http://perso.wanadoo.es/p.gimeno/files/edit-alpha-mask.scm

It is installed in <Image>/Script-Fu/Utils/Edit Alpha as Mask, and automates
the above steps except that it uses a threshold parameter of -1 (which is
not allowed by the slider), thus resurrecting any color info already present
in there. Beware that even if formats like PNG clearly allow to specify
color info for purely transparent pixels, in The GIMP the result of
resurrecting them is absolutely undefined (in almost all cases, however, you
get whatever was there before making it totally transparent, as expected;
this is true for all current versions but may change in future).

Even if it stops working, you can easily edit it to substitute the -1 by a 0
in the call to plug-in-threshold-alpha, which should always work, in which
case it will automate the exact process explained above. Note that you'll
also lose your selection if you don't save it, as the script needs that no
selection is active in order to work with the whole image.

-- 
  Pedro Gimeno
_______________________________________________
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer

Reply via email to