The straight line is not the shortest gradient
Assumes A gradient is a path, A difference is not a distance and What one number accepts.
A gradient is a path fixed the two ends of a blend and showed that everything between them is decided by the space the interpolation happens in — four spaces in daily use put the halfway point of one ordinary gradient as much as thirty-seven colour differences apart. That is a question about which space. There is a narrower question inside any one of them, and the difference formula answers it itself.
ΔE₀₀ says what a small step costs at every colour. A rule for the cost of small steps is a metric, a metric has shortest paths, and the shortest path between two colours under ΔE₀₀’s own local behaviour is not the straight line in CIELAB.
The shortest path bows, and the formula is not its length
Between saturated colours the metric’s own shortest path leaves the straight line by tens of CIELAB units, and the number the formula returns for the two endpoints is neither the length of that path nor of the straight one.
- Red to green: the shortest path bows 12.8 CIELAB units away from the straight line and is 3.6 per cent shorter. Blue to yellow bows 21.0 and saves 7.6 per cent.
- Black to white is straight, to a bow of exactly nothing and a saving of one hundredth of a per cent, which is what symmetry requires of the neutral axis and is the check that the search is finding geodesics rather than wandering.
- The formula’s answer for a pair runs from 0.75 to 1.26 times the length of the shortest path between them across the named gradients, and from 0.84 to 1.29 over forty random pairs. No single factor reconciles the two.
- On red to green the straight line is outside sRGB on 23 of its 25 steps and the shortest path on none of them — the metric’s preferred route is also, here, the one a screen can show.
A formula for small steps is a metric
The construction is short. At any colour, take ΔE₀₀ between that colour and itself displaced by a thousandth of a unit along each axis and along each pair of axes together; from those six numbers, assemble the quadratic form that reproduces them. That is the formula’s local behaviour written as a 3 × 3 matrix, and what one number accepts drew the same object from the other side — the surface a one-unit tolerance accepts is the set of steps that form calls one.
A path’s length is then the sum of its segments, each measured with the form taken at that segment’s own midpoint. The straight line has a length in this sense, and so does every other path between the same two colours; the shortest is found by starting from the straight line and moving the interior points downhill until nothing improves.
The reason the paths bend is in that picture. The form is far from round — a tolerance has a grain measured how far — and it does not keep the same shape from colour to colour. A path can trade a longer route in CIELAB for a route through colours where the form is cheaper, and where the form’s cheap direction is aligned with where the path wants to go.
What the bows look like
The gradient is the thing readers actually see, so it is worth drawing twice.
The straight line from red to green in CIELAB passes through a high-chroma yellow at its midpoint, at a lightness of about seventy — a colour no screen can show, which is why most of the upper row is hatched. The shortest path takes a lower-chroma route through the oranges and olives, and every one of its twenty-five steps is inside sRGB.
That is worth being careful about, because it is a coincidence of mechanism rather than a gamut-mapping step. Nothing in the calculation knows what sRGB is. The metric charges less for a step where the chroma weighting is large, the elongation of the tolerance surface turns with hue, and the route that comes out avoids the extreme-chroma middle — which is exactly the region a display’s primaries cannot reach. Two different constraints happen to point the same way, and they do not point the same way equally often.
Cyan to magenta is the middle case — 23 steps outside against nine — and red to blue is the honest one: 23 against 18, so the metric’s route is barely better. Every gradient that starts outside does better along the geodesic, and only one of the three comes fully back inside. The rescue is a tendency, not a rule.
Three numbers for the same pair
Once a path has a length, a pair has three numbers, and they are not the same number.
Black to white is the sharpest case. The formula returns 100.0 for the pair — as it must, since CIELAB’s lightness runs from 0 to 100 and the weighting at that separation works out that way. Summing the formula’s own small steps up the same neutral axis gives 75.2. The formula’s large answer is a third larger than the sum of its own small ones.
Cyan to magenta goes the other way: the formula says 58.0 and its own steps add to 66.2 along the shortest path — the formula’s large answer is an eighth smaller. Red to blue is 52.9 against 66.5, a quarter smaller.
So ΔE₀₀ is not the distance its own local behaviour induces. That is the same defect a difference is not a distance found by searching for triangle-inequality violations, arriving from the other direction: a formula that violates the triangle inequality cannot be the length of shortest paths, because such lengths satisfy it by construction. What the geodesic adds is the size and the sign — which pairs it overstates, which it understates, and by how much.
Over random pairs the disagreement has no preferred sign: the ratio runs from 0.84 to 1.29 with a median of 1.04, so on average the formula and its own integrated steps nearly agree, and on any particular pair they need not. The saving is a median of 2.8 per cent, a tenth of the pairs save more than 6.1, and the largest saves 13.3.
An evenly drawn gradient is not an even one
Length is not the only thing a path has. It also has a spacing, and the spacing is where the practical consequence lives.
A gradient drawn the ordinary way puts its steps at equal intervals in the coordinates — equal steps of L*, a* and b*. Measured in the formula’s own units, those steps are not equal. On the straight line from blue to yellow the largest step is 2.95 times the smallest; from cyan to magenta 2.85; from red to green 2.38. Even black to white, where the path is exactly right, is 1.69: a neutral ramp in equal steps of L* changes faster at one end than the other, in the units a difference formula is written in.
So a gradient that looks like it was drawn carefully has a fast part and a slow part, and which is which is decided by where the tolerance surface happens to be small. The midpoint is not half found the same thing one level down, in the encoding rather than the metric: code 128 carries about a fifth of white’s luminance, and almost every blur and resize on the web is built on the assumption that it carries half.
The shortest path can be walked in equal steps — that is a property of the parameterisation rather than a discovery, since any path can be respaced — and the relaxation here does it, so its twenty-five steps are equal in the metric to the last digit. Between the two rows of any of these figures, then, are two different claims: the lower one takes a shorter route, and it takes it at a constant rate. A reader comparing them is seeing both at once, which is why the swatch rows are drawn rather than described.
What a drawing program could do with this
Three things, of increasing ambition, and the first is already common.
Respace an existing gradient. Keeping the straight line and merely redistributing its stops so that consecutive stops are equal in ΔE₀₀ costs nothing but a bisection, changes no colour that was not already on the path, and removes the factor of three between the fastest and slowest parts. Software that offers “perceptually uniform” interpolation is usually doing a cruder version of this, in a space chosen to make the arithmetic easy rather than in the metric anybody’s tolerance is written in.
Then re-route it. Taking the geodesic changes which colours appear — the oranges in the red-to-green row are not on the straight line at all — and buys between nothing and eight per cent of length, plus, on two of three hard cases here, a route that stays inside the gamut. Whether the result is better is a judgement about pictures, not about arithmetic, and nobody has been asked.
And do not confuse either with gamut mapping. Most of this diagram cannot be shown is the standing reminder that a colour outside the gamut has to be marked or moved, and the geodesic is not a mapping: it moves a path through colours that are inside, when it can, for reasons that have nothing to do with the display. On red to blue it cannot, and eighteen of its twenty-five steps are still unshowable.
Which of the three is the right answer
Nothing here says the geodesic length is the number a specification should use. It says the three numbers exist and are different, and that using one where another is meant is a mistake with a measurable size.
For a tolerance, the formula’s own answer is the right one, because a tolerance is a statement about two samples and not about a journey between them. That is what ΔE₀₀ was fitted to and what its acceptance decisions mean.
For anything that accumulates, the path length is the right one — a gradient, a ramp, a sequence of corrections, a walk through a colour space. A distance raised to a power has no length made this point about the appearance unit and found the same shape of problem: a ramp cut into more steps measures longer without end. ΔE₀₀ is better behaved — its local metric is a genuine Riemannian one, so path lengths converge as the steps get finer — but its large-difference answers are not those lengths.
And for a gradient, the shortest path is a candidate rather than an answer. Whether a viewer prefers a gradient that is uniform in the formula’s own metric is a question about people, and that experiment has not been run. What can be said is that the straight line is not neutral either: it is the shortest path under a different metric, the Euclidean one in CIELAB, which nobody has claimed describes discrimination since the day ΔE₀₀ was adopted to replace it.
What was computed, and how
The metric at a colour is the quadratic form assembled from six evaluations of ΔE₀₀ at a step of a thousandth of a CIELAB unit — three along the axes and three along the diagonals, which is what a symmetric 3 × 3 needs. The step is small enough for the quadratic term to dominate and large enough that the formula’s own rounding does not.
A path is twenty-four segments. Its length is the sum over segments of the form evaluated at each segment’s midpoint, applied to that segment’s displacement. The shortest path is found by gradient descent on the interior points, with a backtracking step: a step that fails to shorten the path is rejected and the step size halved, so the length falls monotonically. The first version of this had a fixed step and returned, on one pair, a “shortest” path half again longer than the straight line — which is why the monotonicity is enforced rather than assumed.
The path is also respaced after every accepted step, so that its points stay equally spaced along its own length. Without that the relaxation slides points together — minimising a length says nothing about where the points on it sit — and on one pair here the longest segment came out ninety thousand times the shortest. The shape was unharmed and every figure that samples the path by index was wrong, which is the sort of defect that survives a green gate: the numbers were right and the pictures were not.
The named gradients are between sRGB primaries and secondaries and one pair of greys; the random census draws pairs uniformly from the sRGB cube, keeps those more than ten colour differences apart, and reports the distributions. Gamut membership is tested by converting each path point back to linear sRGB and asking whether all three coordinates lie in [0, 1].
What this does not settle
The geodesics are found numerically and there is no closed form to check them against. What can be checked is the neutral axis, where symmetry says the straight line must be the shortest path, and the relaxation finds it to a bow of one unit in a hundred — most of which is the relaxation’s own tolerance.
The metric is ΔE₀₀’s, and the essay’s numbers inherit everything about it, including the hue rotation that where the formula is not smooth found has a hard edge in the blues. A path crossing that edge is crossing a place where the local form changes abruptly; the paths here that pass near it are the blue ones, and their geodesics are the least smooth of the set.
And the whole construction is in CIELAB, because that is where ΔE₀₀ is defined. A metric on colours is not a metric on a space of coordinates — but a geodesic is computed in coordinates, and the same geodesic expressed in another space would be another curve. What is coordinate-free is the length.
Still open: whether a viewer sees the bowed gradient as smoother
The experiment is easy to state and nobody here has run it. Show the two gradients above, in the same number of steps, and ask which looks more even — or, better, ask where each looks as though it changes fastest, which is the judgement the metric claims to predict.
The prediction is that the bowed one looks smoother, because it is the path along which the formula’s own steps are most nearly equal. If a viewer says the straight one is smoother, that is a statement about the formula’s local behaviour being wrong in the middle of the range, which is where it has the least data behind it.
The difference between a rule and its closure
The habit is about a rule for small things being used for large ones.
A local rule — a cost per step, a rate, a derivative, a tolerance — implies a global one by integration, and the global rule it implies need not be the global rule that was fitted separately. When both exist, they can be compared, and the comparison is usually more informative than either.
The move is to integrate the local rule along the best path and put the answer beside the published global one. If they agree, the rule is a distance and may be treated as one. If they disagree by a quarter in both directions, as here, then the two are different objects sharing a name, and every argument that mixes them is a little wrong in a way nobody has measured.
The failure mode is to assume that because both are called a colour difference, they compose. A tolerance does not accumulate along a gradient, and a gradient’s length does not accept or reject a sample.
What this makes readable
Essays that name this one as a prerequisite.
Named alongside this one
Essays reaching for the same objects. Nobody chose these; they are what the index of named objects makes visible.
- A colour has a name ciede2000 · cielab · gamut · perceptual uniformity
- A press is charged for the direction it barely moves anisotropy · ciede2000 · colour difference · quadratic form
- A size is not a direction anisotropy · ciede2000 · colour difference · quadratic form
- How many colours are there ciede2000 · cielab · gamut · perceptual uniformity
- How wrong would the data have to be anisotropy · cielab · colour difference · quadratic form
- The mixture line bows cielab · colour difference · gradient · interpolation
What links here
Every essay whose body links to this one.
The objects this essay names
Each one links to every other essay that touches it.
AnisotropyCIEDE2000CIELABColour differenceGamutGradientInterpolationMetricPerceptual uniformityQuadratic form