gamma correction
Gamma correction is a nonlinear adjustment of pixel brightness that follows a power law: output equals input raised to some exponent gamma. The reason it exists is that almost nothing in the imaging chain is linear. Old CRT monitors produced light roughly proportional to voltage raised to the power 2.2, and human vision is itself nonlinear, far more sensitive to differences among dark tones than among bright ones. Gamma correction is the lever that compensates for these curved responses so that what you capture, store, and display stay consistent.
Formally, with intensities normalized to the range 0 to 1, the transform is V_out = V_in raised to the power gamma (often with a scale factor). A gamma less than 1 is a brightening curve that lifts shadows, used when encoding so that more of the limited bit budget is spent on the dark tones our eyes scrutinise; this is called gamma compression or encoding. A gamma greater than 1 darkens, typically applied at display time (gamma expansion or decoding). The real sRGB standard is not a single exponent but a piecewise curve, a small linear segment near black spliced to a power-law of about 2.4, giving an effective overall gamma near 2.2.
The subtlety that trips people up is that most image files store gamma-encoded (perceptual) values, not linear light. Any operation that physically combines light, blending two images, resizing, blurring, antialiasing, or alpha compositing, is only correct on linear values. Performing such math directly on gamma-encoded pixels darkens gradients, dims downscaled images, and produces fringe colours. The fix is to decode to linear, do the work, then re-encode. Confusion is worsened by the word gamma being overloaded to mean encoding gamma, display gamma, and end-to-end (system) gamma.
Downscaling a black-and-white checkerboard without linearizing yields a grey that looks too dark (around 0.22 instead of perceptual 0.5), because the average is taken on encoded values; linearize, average to 0.5, re-encode to fix it.
Why it matters: filtering, resizing, and blending in gamma-encoded space is a silent, pervasive bug. A 50% grey midpoint between black and white encoded at gamma 2.2 is stored as about 0.73, not 0.5, so naive averaging of pixels is physically wrong, linearize first.