Right way to change a bitmap to a single color of existing transparency

I want to take the alpha channel of a bitmap and create a colorized version of it. Basically, the bitmap's alpha as a mask of a color (or gradient). I also want to apply effects such as blur to the result. Is there sample code for this? Thanks!

In ZIM Cat, we wrapped the CreateJS filter system with ZIM effects.

https://zimjs.com/docs.html?item=Effect - is the over Doc and each effect has its own Doc entry as well which is under https://zimjs.com/docs.html#controls down by EFFECTS.

image

Have a read over this and see some examples and let us know how it goes. The mini site and tool we did are at:

https://zimjs.com/cat/effects.html

https://zimjs.com/016/threshold.html

Thanks! Yes, this is actually what I ended up doing. In other places, I would normally just copy the alpha channel into R, G and B (I would still like to know if you can do this), but ended up using a pair of ColorEffects:

            partB.effect(new zim.ColorEffect(1, 1, 1, 1, 255, 255, 255));
            partB.effect(new zim.ColorEffect(1, 1, 1, 1, r, g, b));

The first one forcing it into a single color (white), and the second pulling it down into the color I want.

1 Like