The sRGB luminance curve is designed to be an approximation of a gamma 2.2 curve, but with a straightline portion near zero to avoid rounding errors in conversions.


It's hard to find good online resources with the to- and from-sRGB conversions expressed in language compatible with nerdy compositing applications, so I thought I’d consolidate some findings here.

Spitzak has the sRGB to linear conversion right:

x < .04045 ? x/12.92 : pow((x+.055)/1.055, 2.4)

And here’s its inverse:

x < .0031308 ? x*12.92 : (1.055*pow(x,1/2.4)) -0.055

The question mark is an if/then. If the conditional before it is true, do what’s before the colon. If false, do what’s after.