RSS/Atom feed Twitter
Site is read-only, email is disabled

Edit Alpha as Mask

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

12 of 13 messages available
Toggle history

Please log in to manage your subscriptions.

20030908192346.92686106B0@l... 07 Oct 20:22
  Gimp-developer Digest, Vol 12, Issue 12 Jean-Christophe Dubacq 08 Sep 21:18
   Gimp-developer Digest, Vol 12, Issue 12 Raphaël Quinet 08 Sep 21:44
    Gimp-developer Digest, Vol 12, Issue 12 Guillermo S. Romero / Familia Romero 08 Sep 22:29
   Gimp-developer Digest, Vol 12, Issue 12 Sven Neumann 08 Sep 21:46
    Gimp-developer Digest, Vol 12, Issue 12 Jean-Christophe Dubacq 09 Sep 08:19
     Gimp-developer Digest, Vol 12, Issue 12 Sven Neumann 09 Sep 11:23
   Edit Alpha as Mask (was: Re: Gimp-developer Digest, Vol 12, Issue 12) usr352@wanadoo.es 09 Sep 18:57
    Edit Alpha as Mask Sven Neumann 09 Sep 21:28
     Edit Alpha as Mask Guillermo S. Romero / Familia Romero 09 Sep 22:58
     Edit Alpha as Mask Jakub Steiner 10 Sep 01:27
     Edit Alpha as Mask usr352@wanadoo.es 10 Sep 18:25
    Edit Alpha as Mask Guillermo S. Romero / Familia Romero 09 Sep 22:47
Jean-Christophe Dubacq
2003-09-08 21:18:32 UTC (over 21 years ago)

Gimp-developer Digest, Vol 12, Issue 12

As I do not think my former message reached gimp-users, I will try there (it also seems more fit, and I am subscribed):

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)...

Sincerly,

Raphaël Quinet
2003-09-08 21:44:30 UTC (over 21 years ago)

Gimp-developer Digest, Vol 12, Issue 12

On Mon, 8 Sep 2003 21:18:32 +0200, Jean-Christophe Dubacq wrote:

As I do not think my former message reached gimp-users, I will try there (it also seems more fit, and I am subscribed):

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)...

Your mail would have been more appropriate for the gimp-user list, because this is not directly related to the development of the GIMP.

Anyway, please check the Eraser tool and enable the "anti-erase" option. This is an ugly hack, but this is probably what you are looking for.

I think that this option should disappear. Instead, we should have an "undo brush". Because in most cases, what you want to do is to recover some data that has been deleted by accident. So you could get that from the undo history. It does not make much sense to "un-erase" something if you do not know what was there before, even if this quick hack was easy to implement in the early versions of the GIMP. So if it becomes possible later to "paint with undo," then we should remove the anti-erase option.

-Raphaël

"eviv bulgroz!"

Sven Neumann
2003-09-08 21:46:42 UTC (over 21 years ago)

Gimp-developer Digest, Vol 12, Issue 12

Hi,

Jean-Christophe Dubacq writes:

As I do not think my former message reached gimp-users, I will try there (it also seems more fit, and I am subscribed):

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)...

In GIMP-1.3 this is as easy as deactivating all channels but alpha in the channels dialog. All paint/fill operations will only affect the alpha channel then.

Sven

Guillermo S. Romero / Familia Romero
2003-09-08 22:29:16 UTC (over 21 years ago)

Gimp-developer Digest, Vol 12, Issue 12

quinet@gamers.org (2003-09-08 at 2144.30 +0200):

On Mon, 8 Sep 2003 21:18:32 +0200, Jean-Christophe Dubacq wrote:

As I do not think my former message reached gimp-users, I will try there (it also seems more fit, and I am subscribed):

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)...

It is the way, I did an script for that, it passed alpha info to mask, removing it from alpha, completly. If you can not find it, ask me.

Anyway, please check the Eraser tool and enable the "anti-erase" option. This is an ugly hack, but this is probably what you are looking for.

Nice hack, I have been using it a lot latelly. For some things it is enough and fast.

I think that this option should disappear. Instead, we should have an "undo brush". Because in most cases, what you want to do is to recover some data that has been deleted by accident. So you could get that from the undo history. It does not make much sense to "un-erase" something if you do not know what was there before, even if this quick hack was easy to implement in the early versions of the GIMP. So if it becomes possible later to "paint with undo," then we should remove the anti-erase option.

Fill layer with something, make some holes... change your mind, rearrange holes. My usage was for hose brushes. Doing if from undo is going to be a bit more complex technically, and will not only do unerase, you will be able to undo paints too or filters, for example.

GSR

Jean-Christophe Dubacq
2003-09-09 08:19:29 UTC (over 21 years ago)

Gimp-developer Digest, Vol 12, Issue 12

On Mon, Sep 08, 2003 at 09:46:42PM +0200, Sven Neumann wrote:

Hi,

Jean-Christophe Dubacq writes:

As I do not think my former message reached gimp-users, I will try there (it also seems more fit, and I am subscribed):

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)...

In GIMP-1.3 this is as easy as deactivating all channels but alpha in the channels dialog. All paint/fill operations will only affect the alpha channel then.

Well... I tried my version (1.3.19). Create a red picture. Create a new layer. Paint it black. And now, I would like to edit alpha directly with the pen tool ('pen'ing in black should in fact let red appear, since white is full opacity and black is transparent). But it doesn't work: whateve color is selected, the pen does not affect alpha.

Maybe it is a bug. But the alpha layer even easily seen, is not editable.

To answer another mail, what I want to achieve is a sort of threshold alpha, but controlled by me (over only some part of the image, and setting part of the alpha layer to 50% opacity)... I know of ways to achieve that, but it makes the task troublesome.

Sven Neumann
2003-09-09 11:23:52 UTC (over 21 years ago)

Gimp-developer Digest, Vol 12, Issue 12

Hi,

Jean-Christophe Dubacq writes:

In GIMP-1.3 this is as easy as deactivating all channels but alpha in the channels dialog. All paint/fill operations will only affect the alpha channel then.

Well... I tried my version (1.3.19). Create a red picture. Create a new layer. Paint it black. And now, I would like to edit alpha directly with the pen tool ('pen'ing in black should in fact let red appear, since white is full opacity and black is transparent). But it doesn't work: whateve color is selected, the pen does not affect alpha.

The paintbrush can only increase opacity, if you need to decrease opacity you will need to use the eraser. What you are describing (black is transparent, white is opaque) only holds true for masks. If you prefer to work that way, use a mask then.

Sven

usr352@wanadoo.es
2003-09-09 18:57:11 UTC (over 21 years ago)

Edit Alpha as Mask (was: Re: Gimp-developer Digest, Vol 12, Issue 12)

Jean-Christophe Dubacq 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 /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 /.gimp-1.3/scripts/

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

It is installed in /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.

Sven Neumann
2003-09-09 21:28:34 UTC (over 21 years ago)

Edit Alpha as Mask

Hi,

usr352@wanadoo.es writes:

- 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.

I think you misunderstood some discussions or you wouldn't talk such a nonsense.

On a related note: In 1.3 we introduced the possibility to initialize the mask from the layers alpha channel. This is still unfinished since it should probably transfer the alpha channel to the mask by making the layer all opaque. The open question here is if this should be the default behaviour. It might be confusing since the other ways of initializing the layer mask don't touch the layer's alpha channel. Any opinions on this, anyone?

Sven

Guillermo S. Romero / Familia Romero
2003-09-09 22:47:05 UTC (over 21 years ago)

Edit Alpha as Mask

usr352@wanadoo.es (2003-09-09 at 1857.11 +0200):

1. Follow these steps:

[...]

2. Copy the following script (which uses an undocumented hack and may cease

3. Use the other script. Thanks Pedro for making me think again if my old one worked or not. It seems preview and image window have some issues updating, that made me think it worked when it did not. This revised script does not have problem with selections (that is the part I had to fix today, by copying the code I already wrote for other scripts) or undocumented values (used a different approach since day 1).

Temp location (if not there, it got a page, so navigate the site): http://www.infernal-iceberg.com/gimp/alpha-to-mask.scm

4. Maybe instead of a script it could be an option for the add layer mask dialog. What do people think about this other solution? Personally I do not think changing the behaviour (without option) would be nice, cos it will disallow effects that are based in already transparent layers plus extra control via the mask (think fading text layer or animations).

GSR

Guillermo S. Romero / Familia Romero
2003-09-09 22:58:56 UTC (over 21 years ago)

Edit Alpha as Mask

sven@gimp.org (2003-09-09 at 2128.34 +0200):

On a related note: In 1.3 we introduced the possibility to initialize the mask from the layers alpha channel. This is still unfinished since

1.2 has that option too. What I think was added is inverse option and selection and grayscale-copy modes.

it should probably transfer the alpha channel to the mask by making the layer all opaque. The open question here is if this should be the default behaviour. It might be confusing since the other ways of initializing the layer mask don't touch the layer's alpha channel. Any opinions on this, anyone?

I would add option to clean alpha channel. Probably a name like "Discard alpha channel contents afterwards" should be fine (except that you will still have alpha channel :-/ ). "Reset alpha channel afterwards" maybe?

GSR

Jakub Steiner
2003-09-10 01:27:34 UTC (over 21 years ago)

Edit Alpha as Mask

On Tue, 2003-09-09 at 21:28, Sven Neumann wrote:

On a related note: In 1.3 we introduced the possibility to initialize the mask from the layers alpha channel. This is still unfinished since it should probably transfer the alpha channel to the mask by making the layer all opaque. The open question here is if this should be the default behaviour. It might be confusing since the other ways of initializing the layer mask don't touch the layer's alpha channel. Any opinions on this, anyone?

I would love to see this be the default. The 'transfer' of the alpha channel to the mask feels very intuitive to me since I'm familiar with the concept of layer masks. I want to edit the layer's transparency. That's what the mask is for. Having this additional concept of a separate alpha channel is somehow confusing I would say.

usr352@wanadoo.es
2003-09-10 18:25:15 UTC (over 21 years ago)

Edit Alpha as Mask

Sven Neumann wrote:

usr352@wanadoo.es writes:

- 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.

I think you misunderstood some discussions or you wouldn't talk such a nonsense.

You're probably right here. I thought that the generally accepted opinion was that zero alpha implied undefined color info, and the anti-erase etc. was just a hack from that point of view and it could be removed in future.

On a related note: In 1.3 we introduced the possibility to initialize the mask from the layers alpha channel. This is still unfinished since it should probably transfer the alpha channel to the mask by making the layer all opaque. The open question here is if this should be the default behaviour. It might be confusing since the other ways of initializing the layer mask don't touch the layer's alpha channel. Any opinions on this, anyone?

I think that many people (including me) would expect to have this feature, and I'm eager to see it implemented. My suggestion to avoid confusion is to offer two options instead of one when creating the mask:

- Copy from Alpha channel - Move from Alpha channel

or alternative wordings such as Copy/Move Alpha to Mask. I think that the emphasis on the copy/move words while keeping the rest of the sentence unchanged will make it clear for everyone that they behave differently and that Alpha info will be deleted after a "move" operation.