0
$\begingroup$

What equation best describes the alpha content of a black colored pixel applied to a white pixel when measuring the resulting pixel intensity?

For instance

  • given a white pixel: argb : 255, 255, 255, 255
  • drawing over it with a black pixel: argb : 78, 0, 0, 0
  • the result is argb : 255, 50.2, 50.2, 50.2

Measuring the pixel's intensity 50.2 should relate an alpha level of 78 when testing for black.

After trying for it, I settled on a rough formula ~> A = 1 - (I / 255) ^ 2.193

Here A = alpha, I = intensity. It could be 1 - I ^ 2.193 if the values for I were in the range 0 - 1. This is just a gamma function subtracted from one to orient the values correctly. For white alpha pixels applied to a black image the formula would be I ^ 2.193.
This may not be near the solution but I can't dream it up. I may have heard of this equation using a power of 2.2, maybe not. Its results are okay, but then again I also liked the results of a linear equation, happily adding 1 level of alpha for each 1 level of intensity less than 255 (white.)

I would really love to read about the science behind this alpha relationship from one of you!

EDIT ...
Thanks to Emre my question is answered. And now that I have the solution I have added some figures to turn it into an example...

Image of sphere Separated image - white part Separated image - alpha part
3 images ~> a sphere separated into a white part and an alpha part

Result obtained using gamma 2.2 Result obtained using Linear relationship
Images obtained using Gamma 2.2 result and Linear result
re-applied to white layers, respectively

Wikipedia sRGB image
Graph from Wikipedia demonstrates the difference between sRGB (standard red green blue) and Gamma 2.2. Here sRGB is the red line plotting the intensity function, and Gamma 2.2 is a black dashed line drawn below the red line. Not much difference

Thus, A = 1 - I ^ 2.2, is nearly correct choice

$\endgroup$
  • $\begingroup$ You're on the right track. Look up gamma correction and sRGB. $\endgroup$ – Emre Oct 27 '14 at 19:23
  • $\begingroup$ @Emre 2.2! Thanks for the direction. $\endgroup$ – Jedi Commymullah Oct 30 '14 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.