A quick note to just so I can keep track of the functions.
def srgb2lin(s):
if s <= 0.0404482362771082:
lin = s / 12.92
else:
lin = pow(((s + 0.055) / 1.055), 2.4)
return lin
def lin2srgb(lin):
if lin > 0.0031308:
s = 1.055 * (pow(lin, (1.0 / 2.4))) - 0.055
else:
s = 12.92 * lin
return s
Note that I picked up these functions somewhere on stackoverflow, I didn’t come up this any of it…