Reinhard transfer in LAB space

Palette Transfer

Take the colour of one image and move it onto another. The transfer runs in LAB space, so the structure, edges and texture of your image are left intact while the palette shifts. Everything happens in your browser.

Reference

the colour you want
Drop an imageor click to browse

Target

the image to restyle
Drop an imageor click to browse

Add a reference and a target to begin.

How the three methods differ

Reinhard

Each LAB channel is shifted and scaled so its mean and spread match the reference. Because it is a single affine map applied to every pixel, no local detail can be invented or destroyed: the tone relationships inside your image survive exactly.

Histogram matching

Rather than matching two numbers per channel, the whole cumulative distribution is matched. The result tracks the reference more closely, which helps when the two images have very different contrast, at the cost of flattening tones the reference does not contain.

Quantise

Every pixel is snapped to its nearest reference swatch, with Floyd-Steinberg dithering to avoid banding. This is the one to use for screen printing or vinyl, where the output really is a fixed number of inks.

What this cannot do

This is colour transfer, not style transfer. It moves palette, warmth and contrast. It will not redraw your image in the reference's brush strokes, and it will not add texture that is not already there.

A global transfer also cannot invent a hue the reference lacks. If the reference is entirely warm and your target contains a strong teal, that teal has nowhere sensible to land and will drift towards the nearest available colour. Lower the strength, or use "keep original lightness", when that matters.

For print, watch the out-of-gamut figure. Colours outside sRGB will be substituted by the printer's own mapping, which is rarely what you expected.

Questions

Why LAB rather than RGB?

In RGB the three channels all contribute to perceived brightness, so changing colour also changes lightness and hue drifts as a side effect. LAB separates lightness (L*) from the two colour axes (a*, b*), which lets the palette move while lightness stays under your control.

How is the palette found?

k-means clustering in LAB, seeded so the starting centres are spread apart. Clustering groups colours the way the eye does, rather than slicing the RGB cube into fixed bins, which tends to report several near-identical swatches for a smooth gradient.

What does the out-of-gamut number mean?

It counts pixels whose transferred colour cannot be represented in sRGB. A few percent is normal. A large figure means the transfer pushed the image beyond what a screen or printer can reproduce, and something has to give.

Does it upload my images?

No. Both images are decoded and processed in the page. Nothing leaves the browser.

Which method should I use for DTF?

Reinhard at a moderate strength for photographic artwork, since it keeps detail intact. Quantise when the design has to print in a limited number of inks, because it tells you exactly which colours you are committing to.