← Back to Home

🎨 Colour Picker

Extract dominant colours from a photo and copy hex values in one tap for palette reference

How to extract a colour palette in three steps

The screenshot below was taken in this tool with a real file and the stated settings — it is not a mock-up.

  1. Upload the imageAny photo or artwork works; the palette is computed locally.
  2. Choose the countThis run extracts 8 colours (the range is 3–16).
  3. Extract and copyPress “Extract colours”, then click a swatch to copy its hex value.
Palette result: eight colour swatches with hex and RGB values, including #E8BE47 and #2E6096.
Captured: Input: specimen-a-1200x800.png (1200 × 800 PNG). Settings: 8 colours. Output: 8 swatches with hex and RGB values.
📁
Click or drag an image here
PNG · JPG · WebP · GIF · BMP · SVG · AVIF · ICO · HEIC / HEIF

Original

Original

(Results appear in the palette below)

Result
Current:8types

Palette (click a value to copy)

Processing…

How to extract colours

  1. Upload the image you want colours from
  2. Drag the slider to choose how many colours (3–16)
  3. Click "Extract" and a swatch card appears below
  4. Click any value to copy it, or "Copy all" to take the whole set

How it works

Extraction uses K-means clustering. Treat every pixel colour as a point in 3D space, place K random centres, then repeatedly assign each point to its nearest centre and recompute the centres until they settle.

The K settled centres are the image's K dominant colours. For stability the algorithm samples (large images are not computed pixel by pixel) and iterates 12 times.

Finally the colours are sorted by luma (0.299R + 0.587G + 0.114B) from dark to light, ready to use as a palette strip.

Common use cases

It works best for:

For designers

Pull a palette from a reference image straight into your design

Slide palettes

Extract brand colours from a company logo or product shot

Home decor and outfits

Take dominant colours from a photo to match furnishings or clothing

Front-end development

Grab HEX values quickly for your CSS

Specifications

Input formatPNG / JPG / WebP / GIF / BMP / SVG / AVIF / ICO / HEIC
Number of coloursAdjustable from 3 to 16
AlgorithmK-means clustering (12 iterations, auto-sampling)
Output valuesHEX and RGB — click to copy
OrderingBy brightness, dark to light

FAQ about colour extraction

The colours look off — what can I do?

K-means starts from random centres, so repeated runs on the same image can differ slightly. Try a different count, or run it a few times and keep the colours that appear consistently.

Why are very bright or dark colours missing?

Clustering is driven by pixel counts, so colours with a tiny share (a small highlight, say) may not form their own cluster. Increase the number of colours in that case.

Do transparent areas affect the result?

No. Pixels below 50% opacity are skipped, so only visible parts are sampled.

Can I save the swatch card as an image?

This version only copies values. For an image, take a screenshot or merge the swatches with the Merge tool.

How the colours are chosen

This is k-means clustering over sampled pixels. The image is sampled on a grid whose step is max(1, floor(sqrt(width × height / 4000))), which targets roughly 4,000 samples regardless of image size; images smaller than that are sampled completely. Each sample is a point in RGB space with no weighting by position or by area beyond the sampling itself. Transparent pixels — alpha below 128 — are skipped entirely, so a PNG with a large transparent margin does not waste palette slots on nothing.

The algorithm then places the requested number of centres at random sample positions and runs twelve reassignment passes. That random start is the reason two runs on the same file can differ by a shade or two: k-means converges to a local solution, and a different start can land in a different one. Running the extraction twice and keeping the colours that appear in both is a cheap way to separate the stable palette from the noise.

Why duplicate swatches appear

If a cluster loses all its members during a pass, the implementation keeps the previous centre instead of reseeding it. On a flat image — a logo on a single background — several centres can end up parked on the same colour, producing identical hex values in the list. That is not a colour-picking bug; it is the honest answer that the requested count exceeds the number of distinct colours the image contains. Reduce the count to 3–5 for flat graphics and the duplicates disappear.

What "dominant" means here, and what it does not

Clusters are sized by how many samples fall into them, so a large area of sky dominates a small area of red signage. That is statistically correct and often wrong for design work: the colour you want is frequently the smallest accent in the frame. Two adjustments help. Crop to the region that matters before extracting, using Crop Image, so the sampling grid is spent on the subject. Or increase the count to 12–16 and ignore the top of the brightness-sorted list.

The list is ordered by brightness, dark to light, not by population. A near-black and a near-white often occupy the two ends regardless of how much of the image they cover.

From swatch to usable design colour

The output is a set of hex and RGB values; no image is re-rendered and no palette file is produced. Two practical gaps follow. First, a cluster centre is an average, so a vivid object photographed with soft light yields a desaturated hex that looks duller than the object. Second, the average of an area containing both shadow and highlight is often a mid-tone that exists nowhere in the picture. For interface work, treat the extracted value as a starting point, then check contrast against the actual background — a mid-tone sampled from a photo rarely passes 4.5:1 against white.

Copying is one click per swatch, and the "copy all" button writes the hex values as newline-separated text, which pastes cleanly into a design token file or a CSS variable block.

Limits and mismatches

  • 3 to 16 colours. Fewer than three cannot describe a photograph; more than sixteen stops being a palette and becomes a histogram.
  • RGB only, no colour management. Samples are taken from the decoded canvas in sRGB. A wide-gamut source is converted before clustering, so the hex describes the screen version, not the print version.
  • No export as ASE, GPL or JSON. Text and clipboard are the only outputs.
  • No area percentages. The list does not say how much of the image each colour covers, so "dominant" has to be judged by eye.
  • No eyedropper on the original. The cluster output is a summary, not a pixel probe; for a single exact pixel the browser's own developer tools are more direct.

Two more questions this page gets

Why do I get different hex values each time I run it?
The centres start at random sample positions and the algorithm runs a fixed twelve passes. Different starting points converge to slightly different local solutions. Raise the colour count, extract twice, and keep the values that recur.
Does the tool change my image?
No. It reads the pixels, computes cluster centres and prints hex values. The file on your disk and the preview are untouched, and there is no download of a recoloured image.