chickadee » macaw » gamma-compress

gamma-compress nprocedure

Performs gamma compression (encoding) of the real number n, converting from linear RGB space to sRGB space. This implements the sRGB forward transfer function, which approximates a gamma of 2.2.

n is usually in the interval [0,1], and the result is usually in the interval [0,1]. To convert from a linear RGB component to an 8-bit sRGB component, do this: (truncate (* 255 (gamma-compress n)))