Mask to Existing image

sorenknud's picture

Hi,

I often want to add an alpha channel to an image in QC.

Is there some kind of good reason why there is not a patch like this:

INPUTS: Image, Mask OUTPUTS: Image (with alpha channel defined by the mask input)

It seems odd to me that i cannot do this very simple....

best, soren

gtoledo3's picture
Re: Mask to Existing image

Unless I am mistaking what you are saying, this is a really old function.

These patches should illustrate this... draw around on the viewer surface.

PreviewAttachmentSize
Blend With Mask.qtz7.74 KB
Erase to Alpha.qtz7.55 KB

sorenknud's picture
Re: Mask to Existing image

You are mistaken.... I don't want to combine two images...

I want to add an alpha channel from image A, to image B - i don't want to blend A and B.

EDITED TO ADD: I have a PNG, and i could place transparency in the PNG file, and put it into my GLSL renderer, but i want to chance the transparency in QC without loading in a new PNG file. So my RGB values stay the same, i will only manipulate the mask.

I have no "Mask"-input like on the billboard - thats why i would like to add it on the image.

best,

soren

gtoledo3's picture
Re: Mask to Existing image

Do you see that in "Erase to Alpha" that what is feeding the blend mask creates alpha channel by feeding a white value?

What you can do is to take the "alpha channel" you want to add, convert it to white, and then blend. This imposes the alpha of one image onto another.

"Erase to Alpha.qtz" can be used as a starting point, you just have to control the color values on the image you feed by making your desired alpha mask white first (this can be done with Core Image patches... the NI color channel invert is handy for doing this quickly). If you want to add alpha from one image to another, you are blending, by definition.

Hope this helps.

gtoledo3's picture
Re: Mask to Existing image

If you are doing that with GLSL, then you have to define this in the shader using two inputs. I thought you wanted to add alpha to an image (re: your original post), but I don't know if that's what your really asking now that I see this.

You could do it with a blend mode before it hits your glsl image input.

sorenknud's picture
Re: Mask to Existing image

Great, i thougt the different blend modes where only to combine 2 images - and that they could not do what you do in this comp..

thanks alot for your help - it was just what i needed.

best.

soren

gtoledo3's picture
Re: Mask to Existing image

No problem! There are so many things that can be done with the blend modes that it gets obscure. The very question you ask eluded me for awhile as well. This is useful for me when using Kineme 3D object renderer/plane generator in place of Billboard or Sprites that I'm using the mask input on, when I decide I want to be able to deform the plane and still have the function I was getting with the mask input.

epochapex's picture
Re: Mask to Existing image

Thanks gtoledo3. This is useful to me as well.

epochapex's picture
Re: Mask to Existing image

Actually the two examples are pretty challenging.