alpha channel computation

View: New views
2 Messages — Rating Filter:   Alert me  

alpha channel computation

by Nerius Landys :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello.  I have a TGA image that is fully opaque.  I want to introduce translucency to the image, making each pixel translucent according to how far away from black it is.  If a pixel is originally black, it becomes fully opaque.  If a pixel is originally white, it becomes fully transparent.  If a pixel is 0x7f7f7f (gray) or 0xff007f (approximately halfway in brighness between dark and light), it becomes somewhere around half transparent (computed using diagonal of color cube).

Is there an easy way to do this in GIMP?  i can imagine writing a quickie computer program to do this for me, but I'm sure the easier way would be to convince GIMP to do this for me.

Thanks.


_______________________________________________
Gimp-user mailing list
Gimp-user@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Re: alpha channel computation

by Sven Neumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Thu, 2008-07-24 at 11:49 -0700, Nerius Landys wrote:

> Hello.  I have a TGA image that is fully opaque.  I want to introduce
> translucency to the image, making each pixel translucent according to
> how far away from black it is.  If a pixel is originally black, it
> becomes fully opaque.  If a pixel is originally white, it becomes
> fully transparent.  If a pixel is 0x7f7f7f (gray) or 0xff007f
> (approximately halfway in brighness between dark and light), it
> becomes somewhere around half transparent (computed using diagonal of
> color cube).
>
> Is there an easy way to do this in GIMP?

Easy. Just add a layer mask. In the dialog for creating the mask, choose
to initialize the mask with "Grayscale copy of layer". Now you already
got almost what you want. You just need to invert the mask as you want
white to be transparent and black to be opaque. Colors->Invert will do
this. Now all you need to do is to apply the layer mask.


Sven



_______________________________________________
Gimp-user mailing list
Gimp-user@...
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user