Map an image onto a palette

Every pixel is remapped locally — this page has no server to send to.

Give it two to sixteen colours and every pixel moves to its nearest one, measured the way the eye measures difference. The rail prints how much of the frame each swatch took.

Open an image, then pick the colour you want changed.

Open a picture; it is mapped onto your saved brand colours, or a six-colour starter palette, which you can replace by pasting your own.

Drop an image here, or browse for one

JPG, PNG, WebP and GIF decode in every browser; BMP, TIFF and ICO open where yours knows them, and a TIFF usually only does in Safari. HEIC pulls a codec the first time one arrives.

Nothing to hand?

Sampled
#be241f → #00999d
Coverage
20.9% of the frame
One frame, one selection, and the number that decides it. The paint rotates onto a teal hue at the lightness it already had, so every highlight and shadow in it survives. The brick, the tarmac and the jacket are outside the selection and are the pixels they arrived as. Every figure here is computed by the same function the tool runs on a photograph.

Nearest, in a space that agrees with the eye

“Nearest” is measured in OKLab, where equal distances look like equal differences. In RGB, the nearest swatch to a dark blue can come out as a dark green simply because the channels are not perceptually spaced. With lightness kept, the comparison leans on the colour axes, so a dark red and a light red both go to the red swatch and keep their shading.

The dither is ordered, a fixed four-by-four pattern, so the same picture and palette give the same file every time, at every preview size and at full resolution.

Where a mapping goes wrong

  1. A palette without a dark and a light swatch maps shadows and highlights onto whatever is nearest, which can be surprising in exact mode.
  2. One swatch is not a palette; the rail refuses it and asks for a second.

Questions people bring to this page

Is this the same as posterising?
No. A posterise effect invents its own levels. This maps the picture onto a palette you supply — pasted values, your saved brand colours, or a palette taken from a second picture — and reports how much of the frame each swatch ended up holding.
One of my swatches says 0%. What does that mean?
Nothing in the picture is nearer to that swatch than to another one, so it was never chosen. Either the palette has two swatches close together, or the picture has nothing in that region of colour; replace the swatch or remove it.
Should “keep each pixel's lightness” be on?
For photographs, usually yes: shading stays the picture's own and only the colour comes from the nearest swatch, which reads as a recolouring rather than a cut-paper effect. For flat art, off: each pixel becomes the swatch exactly, and the result can be saved as a fresh indexed PNG.
Can the result be saved with a real palette?
When the mapped picture has 256 colours or fewer at full size — exact mode, full strength, no region edges — the Save as list offers “Indexed PNG, new palette”. That is a re-encode with a fresh table, labelled as one, unlike the exact table rewrite on the PNG palette page.

Next door