Alpha blending a red, blue, and green image to produce an image tinted to any rgb value?

The basic "equation" of alpha combination is: alpha * (R1,G1,B1) + (1-alpha) * (R2,G2,B2) When you have three layers with alpha you are actually combining 4 layers (the 4th one is black) so the final color is: alpha1 * (R1,G1,B1) + (1-alpha1) * ( alpha2 * (R2,G2,B2) + (1-alpha2) * ( alpha3 * (R3,G3,B3) + (1-alpha2) * (0,0,0) ) ) Provided you have the same image on each layer and layer1 is the red channel (G1=B1=0) and layer2 is green and layer3 is blue you get: (alpha1 * R, (1-alpha1)*alpha2 * G, (1-alpha1)*(1-alpha2)*alpha3 * B) For a white pixel you can do any possible color. For a black pixel you cannot do anything but black. For any other pixel, you are restricted by the values of R, G and B Say you wanted to achieve (Rd, Gd, Bd) at a pixel where the current color is (R, G, B) then you would have to choose: alpha1 = Rd/R alpha2 = Gd/(G*(1-alpha1)) alpha3 = Bd/(B*(1-alpha1)*(1-alpha2)) The problem is that alpha can typically only be between 0 and 1.So, for example, if Rd > R there is nothing you can do You can do better if you can control the blending function (for example, in Photoshop).

The basic "equation" of alpha combination is: alpha * (R1,G1,B1) + (1-alpha) * (R2,G2,B2) When you have three layers with alpha you are actually combining 4 layers (the 4th one is black) so the final color is: alpha1 * (R1,G1,B1) + (1-alpha1) * ( alpha2 * (R2,G2,B2) + (1-alpha2) * ( alpha3 * (R3,G3,B3) + (1-alpha2) * (0,0,0) ) ) Provided you have the same image on each layer and layer1 is the red channel (G1=B1=0) and layer2 is green and layer3 is blue you get: (alpha1 * R, (1-alpha1)*alpha2 * G, (1-alpha1)*(1-alpha2)*alpha3 * B) For a white pixel you can do any possible color. For a black pixel you cannot do anything but black. For any other pixel, you are restricted by the values of R, G and B.

Say you wanted to achieve (Rd, Gd, Bd) at a pixel where the current color is (R, G, B) then you would have to choose: alpha1 = Rd/R alpha2 = Gd/(G*(1-alpha1)) alpha3 = Bd/(B*(1-alpha1)*(1-alpha2)) The problem is that alpha can typically only be between 0 and 1. So, for example, if Rd > R there is nothing you can do. You can do better if you can control the blending function (for example, in Photoshop).

– Chris Jan 8 '10 at 21:30 I've edited my answer. Please consider upvoting/checking if you think its a good answer. – Philippe Beaudoin Jan 8 '10 at 21:56 I am experimenting in photoshop by layer 3 circles over each other and plugging in the values.

The circles are colored r: 0xff0000 g: 0x00ff00 b: 0x0000ff If I want to achieve color value 0xaa5588, your formula gives alpha values of .69, .32, .78, respectively. However, these layerings don't produce the proper color, whether over a black or white background. This is essentially the scenario I am trying to achieve.

I also tried subtracting the lowest of the 3 target values (0x55) from each other, and using those new values over 0xFF, which gets closer, but not quite there. Any thoughts? – Chris Jan 8 '10 at 22:35 I made a mistake in my derivation, corrected now I hope.

It also means that you've got a much reduced range in the color you can achieve.To achieve 0xaa5588, the values should be: 0.66, 1, infinity. In other words, you cannot do it. – Philippe Beaudoin Jan 8 '10 at 23:51 Note that this is order dependent.

If you layer it in another order: green first, then blue, then red, the alpha you needs are: 0.33, 0.8, 5.0. Still you cannot do it, unfortunately. – Philippe Beaudoin Jan 8 '10 at 23:57.

I don't think that's possible, if I understand you correctly. If, for a certain pixel, your image's red value is, say, 0.5, you can combine that with an alpha in the (typical) range 0,1 to form any value up to and including 0.5, but you can't go above, to get e.g. 0.6 or so as the output value.

If you're looking to create 3 layers that blended together add up to the original image, it's quite possible. Here's a link to a Python script that calls functions in Paint Shop Pro to do the hard parts. pixelnook.home.comcast.net/~pixelnook/Sp... If you need more detail than that, leave a comment and I'll try to fill it in later.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions