Concept

Transfer function — where it appears

The curve between a code value and a luminance, which is where a number stops being a ratio and starts being an amount of light. Encoding and decoding are separate curves and their mismatch is deliberate, since a display in a dim room is expected to add contrast.

Named by 25 essays across 5 fields — each of them below, with the objects they name alongside it.

A gamma probe: which grey matches a half-white dither?. The striped block on the left is half white and half black, so it carries half the luminance of white. Stand back until the stripes blur and find the patch that matches it. On an sRGB display the answer is code 188, not 128 — code 128 has only 22 per cent of white's luminance.

The display is an unknown

This site is displayed on the very apparatus it is about, and it knows almost nothing about that apparatus. Two figures here stop assuming and ask instead — a probe for the transfer function and a probe for the gamut.

limits · Limits
The sRGB transfer function, and the gamma 2.2 curve it is not. Code value against relative luminance. The sRGB function is piecewise — a short linear segment near black, then a 2.4 power law with an offset — and it is close to but not the same as a plain 2.2 power law. Half-way along the axis of stored values sits at 21 per cent luminance, and half the luminance of white is at code 188.

The midpoint is not half

Code 128 sits halfway along the sRGB scale and carries about a fifth of white's luminance. Half the luminance is code 188. Almost every gradient, blur and resize on the web gets this wrong, and the errors are visible once known.

difference · Metric
The sRGB transfer function, and the gamma 2.2 curve it is not. Code value against relative luminance. The sRGB function is piecewise — a short linear segment near black, then a 2.4 power law with an offset — and it is close to but not the same as a plain 2.2 power law. Half-way along the axis of stored values sits at 21 per cent luminance, and half the luminance of white is at code 188.

A hex code is not a colour

Six hexadecimal digits identify three numbers. Turning three numbers into a colour needs a colour space, a transfer function, a white point and a display, and leaving any of them unstated is the everyday version of every confusion in colour management.

matching · Gamut
Three ways to spend a thousand code values. Normalised code value against luminance, for PQ, HLG and a conventional gamma curve, all covering 0.001 to 10000 cd/m². PQ spends 51% of its range below 100 cd/m² — roughly where a picture lives — and the gamma curve spends 15%, leaving the rest for highlights. A PQ code is the only one of the three that names a luminance rather than a fraction of whatever the display can manage.

How bright is white

An sRGB value says a pixel is some fraction of whatever the display can manage. A PQ value says it is two hundred candelas. The change is the largest in display encoding since gamma, and what it removed was the honest admission that nobody knew.

limits · Limits
sRGB, Display P3 and Rec. 2020 compared on the chromaticity diagram. Three nested triangles inside the horseshoe. sRGB covers 74 per cent of the area P3 covers. Rec. 2020's red and green primaries sit on the spectral locus itself, within 0.000 and 0.006 of it, meaning they are monochromatic.

Six numbers make a space

An RGB colour space is eight numbers — three primary chromaticities, a white point, and a transfer function — and everything else about it is derived. Deriving it rather than copying the matrix is the difference between having a colour space and having a table somebody else computed.

matching · Gamut
Everything between the photons and the picture, and what each stage decides. The 8 stages of a camera pipeline. Only the second is physics; every one after it is a decision somebody made, and the reason two cameras pointed at the same scene disagree is that they made different ones.

Raw is not a picture

A raw file is three integrals per site and a list of decisions nobody has taken yet. Every one of those decisions has a defensible answer and none of them has a correct one, which is why two converters open the same file and disagree.

imaging · Capture
One pair of colours, blended in four spaces. Every row starts and ends at the same two colours and visits different ones in between. The chroma of the middle falls furthest in linear light, by 83 units below the straight line between the endpoints' chromas — the grey dead zone that every blue-to-yellow gradient has and that no endpoint mentions. Any colour a route visits that this display cannot show is hatched rather than clipped.

A gradient is a path

Two colours fix the ends of a blend and nothing else. The middle is decided by the space the interpolation happens in, and four spaces in daily use put the halfway point of one ordinary gradient as much as thirty-seven units of colour difference apart.

matching · Gamut
A 8-bit ramp from 0.0008 to 0.006 of white, 12° wide. The top strip is the ramp as delivered: 16 distinct levels, each a step of one code value. Below it is the quantisation error as a Weber contrast against the local luminance, filtered by the luminance sensitivity function. The largest response is 8.51 per cent contrast against a threshold of 0.3, which is 28.4 times over — and it occurs at 0.09 per cent of white, at the dark end, because a code step is a Weber contrast and the same step is a larger fraction of less light.

Banding is not a bit depth

Eight bits bands at thirty times threshold in the shadows and at under three at mid grey, on the same ramp with the same encoding. What decides is where in the tone scale the gradient sits, how sharp each step's edge is, and how far away the reader is — and a bit count contains none of the three.

limits · Limits
What a dither mask is worth, read as components, in two dimensions. Five luminance ramps, each quantised to 8 bits with and without a high-passed mask of the same power. The bars are the most visible single sinusoidal component of the error, as a multiple of the contrast that component needs to be seen: above the line at one it is visible. The mask lowers it by 20–22×, on every ramp — which the one-dimensional model on this site says it does not, and that disagreement is the finding.

Every threshold was measured with a grating

An earlier essay here claimed that the model cannot explain why dither works, and named two missing pieces. One of them was real and worth thirteen times the guess; the other was not needed. The piece nobody named was the detector — and reading the same model two ways changes the answer by a factor of fifty.

limits · Limits
What a code lattice costs, and where. Twelve thousand colours quantised to 8 bits per channel through the sRGB transfer function and read back, with lightness across the bottom and the colour difference the rounding cost up the side. The mean is 0.191 and the worst case is 1.15, a factor of 6.0. The bars are band means, and they rise: the encoding spends its codes in the shadows, so the top of the ramp is where the lattice is coarsest against a metric that does not compress as hard.

A lattice has no derivative

Every departure priced here was priced by perturbing something and reading the answer, which requires the thing being perturbed to have a derivative. A file written on a code lattice does not have one — its output is flat almost everywhere and jumps on a set of measure zero — so quantisation can be bounded and never propagated. The bound is 1.15 colour differences at eight bits per channel against a mean of 0.19, and it is worst where the encoding spends fewest codes.

matching · Gamut
Three exchanges, two of which move the colour. The documented pipeline is a white balance, a colour matrix, a tone curve and a clip. Each bar is what happens when two neighbours change places, over 30 surfaces the modelled sensor captures: the filled bar is the mean and the tick is the worst patch. Exchanging the balance and the matrix costs 9.2 colour differences at the mean and 13.2 at the worst. Exchanging the curve and the clip costs exactly nothing, and that is a theorem rather than a small number: a monotone curve onto the unit interval commutes with clamping to it.

The order is not in the documentation

A raw converter performs a white balance, a colour matrix, a tone curve and a clip, and every account of the process lists them in that order without saying the order decides anything. Exchanging the first two moves the picture by nine colour differences at the mean and thirteen at the worst patch. The twenty-four arrangements collapse into five outcomes running out to sixty-five, and nothing a converter ships says which of them it is.

imaging · Capture
Where the mosaic is filled in, along one row through an edge. A Bayer row across a step from 0.9 to 0.08, in units of the sensor's own ceiling, reconstructed in linear light and reconstructed after the tone curve, with the second undone so the two are compared at the same point in the chain. Away from the edge they agree to 8.3e-14, because a constant interpolates to itself under any curve. At the edge they differ by 5.78 colour differences. Interpolating encoded values pulls an edge towards its dark side.

One step has no choice

Four of a raw converter's operations can be arranged twenty-four ways. The reconstruction cannot be arranged at all — a colour matrix needs three numbers and a mosaic site has one, so filling in the mosaic is forced to the front by arithmetic rather than by convention. What is not forced is whether it happens in linear light or after the curve, and that decision costs 5.8 colour differences at an ordinary edge and nothing at all four sites away from it.

imaging · Capture
A hue circle through a per-channel curve. 28 colours on a circle of constant lightness 55 and chroma 38, each put through the tone curve one channel at a time and read back. The curve is a function of a single number and has no idea what hue is, and it rotates the circle by up to 4.4 degrees — largest at hue 260 — while raising chroma by a factor of 1.27 and lightness by about 1 units.

A contrast control is three controls

A tone curve is a function of one number at a time and knows nothing about hue. Applied to each channel separately it rotates a hue circle by up to seventeen degrees, raises chroma by a factor of 1.27 at ordinary strength, and lifts lightness — so a photographer who moves a contrast slider has moved three things and the interface names one of them. All three scale with the curve's strength, monotonically, and the hue rotation depends on which hue it is.

imaging · Capture
A stop taken in raw, and the same lightness reached afterwards. Each row is a stop of exposure applied to the raw values, against a gain applied after the whole pipeline and solved so that an eighteen per cent grey comes out at the same lightness. The two are then the same brightness by construction and differ by 4.2 colour differences at the mean and 11.1 at the worst patch. A stop is a scalar in front of the curve and is not a scalar behind it.

A stop is not a stop afterwards

Doubling the light is exactly a factor of two in raw values and in tristimulus values, which is the one thing about exposure everybody is sure of. A stop taken after the tone curve is a factor of something else, and matching the two on an eighteen per cent grey leaves the rest of the frame between three and four colour differences apart at the mean and up to eleven at the worst patch. The gain that matches one stop is 2.47 rather than 2.

imaging · Capture
The same highlight, clipped in two places. A ramp running from inside the sensor's range to 1.6 times over it, clipped at the sensor and clipped after the matrix. Below the ceiling the two are identical to the floating-point floor. Above it they part, reaching 21.0 colour differences and 78 degrees of hue. Clipping late keeps a highlight neutral and clipping early keeps its hue, and converters do both.

Two converters and one highlight

The clip is the only step in a raw pipeline that destroys information rather than moving it, and it is the step whose position varies most between converters. Below the sensor's ceiling its position changes nothing at all, exactly. Above it, clipping at the sensor and clipping after the matrix land twenty-one colour differences and seventy-eight degrees of hue apart, and which hues are affected is a property of the camera's own dyes.

imaging · Capture
The same blend, taken on the stored values and on the light. Six pairs blended at 50 per cent, once by averaging the values as they are stored and once by averaging the light they stand for. Every resize, every antialiased edge and every transparency composite in an ordinary pipeline does the first. The two land 15.8 colour differences apart at the mean and 19.3 on a red against a green, and the stored-value blend is the darker on all six, by up to 23 units of lightness.

An average on the stored values

A resize, an antialiased edge, a transparency composite and a chroma subsample are all averages, and in almost every pipeline they are taken on the numbers as stored. The numbers as stored are encoded, the encoding is a compression, and a half-and-half blend of black and white taken that way lands 18.7 colour differences from the half-and-half blend of the light — 22.7 units of lightness darker, on every pair, always in the same direction.

applied · Delivery
One edge magnified four times, three ways: text on a page. A step between the two colours of text on a page, magnified four times by linear interpolation, by bicubic and by a three-lobe Lanczos kernel, once on the stored values and once on the light. The curves are the stored-value result's lightness minus the light's, sample by sample across the edge; below the line the stored-value resize is darker. Linear interpolation is darker everywhere it differs. The two kernels with negative lobes swing above the line beside the edge, where their negative weights fall — bicubic by up to 1.8 colour differences and Lanczos by 3.7.

A resize with a negative weight in it

A blend taken on stored values is always darker than the blend of the light, because the encoding is concave and a convex combination of a concave function's values lies below the function of the combination. A bicubic or Lanczos resize is not a convex combination. Beside an edge its negative weights make the stored-value result lighter than the light's own — by up to 6.1 colour differences with bicubic and 12.2 with Lanczos on skin against its shadow — and on edges between full-scale values the clip hides the overshoot and the old guarantee appears to hold.

applied · Delivery
The corner of a patch of skin against its own shadow, magnified four times by Lanczos, three lobes. A map of the neighbourhood of one corner of a square patch — the patch fills the lower right, the field the rest — once it has been magnified four times by Lanczos, three lobes. Each cell is shaded by how much lighter (warm) or darker (cool) the stored-value result is than the light's, the deepest shade 18.2 units of lightness. Within three source pixels of the corner the stored-value result is up to 14.5 colour differences lighter, 14.5 outside the patch against 3.1 inside it, and up to 7.3 darker.

The corner of a resized patch is lighter than its edges

A resize taken on stored values is darker than the resize of the light wherever its weights are positive, and lighter beside an edge where a kernel's negative lobes fall. In two dimensions the kernel is a product, and just outside a patch's corner a Lanczos magnification of skin against its shadow comes out 14.5 colour differences lighter — more than along either edge. A reduction to a quarter is mostly an average and errs lighter by at most two. And an unsharp mask, whose negative weights are its whole purpose, is lighter on the stored values at every amount on every pair, and never darker.

applied · Delivery
Where an unsharp mask errs, per pixel and as seen: print, 40 cm. The upper-left corner of a patch of skin against its shadow after an unsharp mask, as two maps of the colour difference between the result taken on stored values and taken on light. Left, pixel by pixel: the corner peaks at 16.8 and the middle of the edge at 16.6. Right, after the eye's three spatial channels at a print at 40 cm: the corner is seen at 17.1 and the edge at 7.1, a ratio of 2.40. Darker is larger, on one scale for both maps.

The eye counts a corner's error, not its peak

A Lanczos-magnified patch errs a fifth more at its corner than along its edges, pixel by pixel, and an unsharp mask errs almost exactly as much at its corner as along its edges. Filtered by the eye over the plane rather than along a line, the two swap: the magnified corner is seen exactly as its edge is, and on a printed page the sharpened corner is seen at 2.4 times its edge. What decides it is whether the error changes sign. Ringing averages away and a one-sided halo does not, and a corner is where two edges' halos land on the same patch of retina.

applied · Delivery
The hue disagreement with the quantiser, and without it. For twelve base colours of CIELAB lightness 50 and chroma 40, the factor by which ΔEITP's reading of a lightness pair over its reading of a chroma pair changes from a 1.5 to a 10,000 candela white. With the perceptual quantiser, it runs from ×0.75 at the yellow-greens to ×1.23 at the violets. With the quantiser replaced by a pure power law and nothing else changed, it is ×1 at every hue.

The hue disagreement is the quantiser's

As a display brightens, the appearance model shifts every colour's balance between lightness and chroma by one factor, and ΔEITP shifts violets towards lightness and yellow-greens towards chroma. The proposed source was the perceptual quantiser acting on three cone-like signals at unequal levels. Replacing the quantiser with a pure power law and changing nothing else removes the disagreement exactly: every colour moves by a factor of one. With the quantiser, how far a colour moves follows the spread of its three signals, and which way follows where its S signal sits — above the other two, towards lightness; below, towards chroma.

difference · Metric
The turn is set by the level the blue arrives at. For displays with a red line at 630 nm, a green at 505 to 545 nm and the census's blues, balanced to D65: the turn — the blue at which adding green moves ICtCp's red–green axis from M-ward to L-ward — against the level the blue is delivered at, whatever peak and drive deliver it. With the 530 nm green it runs from 451.6 nm at 10,000 cd/m² to 457.3 at 10; a dimmer blue turns at a longer wavelength for every green.

A tone-mapped blue turns where it lands

In ΔEITP a display's blue corner, and the turn at which adding green to it changes which side of ICtCp's red–green axis it moves the colour to, both shift with the display's peak, because the quantiser reads absolute levels. A high-dynamic-range picture graded on a bright master and shown on a dimmer panel is tone-mapped, its blues delivered below the levels they were graded at. The prediction was that a blue at a tenth of full drive on a 1,000 cd/m² panel turns where a 100 cd/m² panel's full blue does, and that the corner's move differs, because the dimmed blue no longer sits at a vertex. The turn agrees within a hundredth of a nanometre. So does the corner, within half a per cent: the steps both are read from are directions at one absolute signal, whatever drive delivered it. The tone map's whole effect on the blue is where it puts the blue. Through ITU-R BT.2390's curve, a master's bright blues are gathered near a dim display's peak and share one turn there — two nanometres from where the master turned them — while blues under the curve's knee keep their turns exactly.

matching · Gamut
Per channel, a tone curve turns a sky's blue towards cyan. A blue of the 530 nm green's display mixed with a share of green, graded at full blue drive on a 1,000 cd/m² master and shown on displays of 100 and 300 cd/m² through BT.2390's curve applied to each channel or to the largest with all three scaled together: the change in the mixture's ICtCp hue from the master's. Per channel on the 100 cd/m² display the hue turns 23.4° towards the green at a tenth of green; scaled, it moves under three degrees at every share.

A tone curve per channel turns a sky towards cyan

A pure blue tone-mapped from a bright master to a dim display turns, in ΔEITP, wherever its delivered level puts it, and any tone curve that delivers it to the same level gives it the same turn. A picture's blue is not pure. The prediction for a blue mixed with a little green was that a tone curve applied to each channel separately raises the green's share by about half — the blue channel compressed above the curve's knee, the dimmer green left near it — turning the mixture's hue several degrees towards cyan and its turn a nanometre or more from where a curve that scales all three channels together puts it. The turn does move, by 1.6 to 3 nanometres on a 100 cd/m² display and up to 6.5 on a 300. But the share is not raised by half: through BT.2390 to a 100 cd/m² display, a blue graded with a tenth of green arrives with its green at 69 per cent of its blue, nearly seven times as much, and its ICtCp hue turns 23 degrees towards the green. The scaled curve keeps every mixture's hue within three degrees and its turn within half a nanometre of the pure blue's.

matching · Gamut
A blue's intensity sits below where the curve compresses. BT.2390's curve from the 1,000 cd/m² master to displays of 100 and 300 cd/m², with the level a pure blue, a tenth-green and a half-green sky present to it when the curve is applied to ICtCp intensity, and the level their blue channel presents when it is applied per channel or to the largest channel. The skies' intensity corresponds to 79 to 387 cd/m², against knees of 27.9 and 161.4; their blue channel sits at 1,000, the top of the curve.

A curve on intensity cannot see a blue's brightness

ITU-R BT.2390's tone curve applied to each channel of a bright master turns a tone-mapped sky's appearance fifty-two hue-quadrature units towards green on a 100 cd/m² display; applied to the largest channel with all three scaled, it keeps hue and lightness to a quarter of a unit. BT.2390 also describes applying the curve to ICtCp's intensity and scaling its chroma, which keeps ICtCp's hue by construction, and the prediction was that it keeps the appearance's hue within three units and its lightness within two. It keeps the hue, within 2.3 units. It cannot keep anything on the display: a saturated blue's intensity is the PQ level of 79 cd/m², under the 300 cd/m² display's knee, so the curve barely touches it and every sky asks for two to seven times the blue the display has. Clipped channel by channel, the sky turns as far as the per-channel curve turned it; scaled back into the gamut, it lands where the scaled curve put it. The step back into the gamut decides the appearance, not the curve.

matching · Gamut
Holding ICtCp's hue and lightening the chroma still turns the sky. Each mixture mapped by BT.2390 on ICtCp intensity on the 100 cd/m² display and brought into its gamut three ways — clipped channel by channel, scaled until the largest drive is full, and by its ICtCp chroma alone at fixed intensity and hue — read as the change in CIECAM16 hue quadrature from the master's. The chroma-only return moves −16.8, −14.4, −12.6, −17.0, −9.2 units at no green to half green; scaled into gamut, −1.3, −1.6, −1.8, −1.6, −2.2.

Lowering only the chroma turns the sky white and its hue with it

A tone curve applied to ICtCp's intensity keeps a high-dynamic-range sky's hue, but a saturated blue's intensity lies under the curve's knee, so the colour it asks for lies outside every display's gamut. The prediction was that bringing it back by lowering its chroma alone — intensity and ICtCp hue held — keeps the CIECAM16 hue within three units, lifts the lightness by ten and halves the chroma: a paler blue of the right hue. The ICtCp hue and intensity are kept to a hundredth. Everything else fails. The chroma must fall to a fifth or less on a 100 cd/m² display, the sky rises from a lightness of 22 to 76 and higher, and its hue quadrature moves eight to seventeen units toward green — a pure blue's by 17. Holding ICtCp's hue while lowering chroma does not hold the hue a viewer sees, and the intensity the curve chose was never a blue's.

matching · Gamut
Holding the true hue saves one or two units of seventeen. Each mixture's CAM16-UCS distance from the master on the 100 cd/m² display: mapped on intensity and returned by ICtCp chroma, returned along CIECAM16's hue at the same lightness, scaled into the gamut, and the master's drives shown unmapped. The CIECAM16 return lies 16.7, 17.2, 17.3, 16.8, 15.7 from the master, against 18.9, 18.7, 18.5, 17.6, 16.8 for ICtCp's; the master's own drives 4.14, 4.10, 4.07, 4.02, 4.05.

The sky a dim display can show best is the master's own

A tone curve applied to ICtCp's intensity maps a saturated high-dynamic-range sky to a colour no display can show, and bringing it back by lowering only its ICtCp chroma turns it pale and toward green. The prediction was that a return along CIECAM16's own hue line, at the lightness the curve chose, holds the hue by construction, needs a deeper chroma cut, and still lies at least twice as far from the master as simply scaling the drives. It holds the hue to a hundredth, keeps more chroma than ICtCp's return rather than less, and lies two and a half to four times as far as scaling — because holding the true hue removes only one or two of seventeen units of difference. The rest is the lightness the curve held. And the nearest a dimmer display can come to the master's appearance turns out to be the master's drives, shown unmapped.

matching · Gamut

Named alongside it

The objects these essays reach for when they reach for this one.

Colour managementSpecificationDynamic rangeDeclared inputLightnessClippingStructural choiceΔEGammaGamut mappingHue quadratureInterpolation

All concepts