I'm trying to figure out a problem for a program I'm writing. I am calculating color values, and they get premultiplied by the alpha. I want to figure out what the alpha was before hand and divide the color by that.

I have the new premultiplied alpha (let's say alpha is $.25$ or $25\%$)

$\alpha = .25 * .25$;

$\alpha = .0625$

Given this information, I want to figure out $.25$ from $.0625$

$.0625 = x \times x$

My math is super bad/rusty. Any help would be great!

  • 5
    $\begingroup$ Do you know what a square root is?... $\endgroup$
    – Cure
    Jun 22, 2014 at 2:48
  • $\begingroup$ Ah, easy. Thanks. $\endgroup$
    – M2tM
    Jun 22, 2014 at 2:49

1 Answer 1


As per Cure's suggestion:

sqrt(.0625) does what I want!

*EDIT: For those curious, you can see the related issue I had: https://stackoverflow.com/questions/24346585/opengl-render-to-texture-with-partial-transparancy-translucency-and-then-rende

This solved my problem 100%.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .