Key takeaways
- Palette extraction clusters an image's colours (typically k-means or median-cut over quantised pixels) and reports the dominant groups with their real proportions.
- The dominant colour is rarely the subject — count pixels, not importance; a 70% sky will lead the palette and you may want the 3% jacket.
- Apply extracted colours with the 60-30-10 rule: dominant surface, secondary structure, accent energy — and pull a neutral out for text.
- Extract from the mood reference, not the subject reference: film stills, album covers and travel photos yield the most usable schemes.
- The output codes are RGB and HEX; a palette tool's job ends at the swatch, so check contrast against white and black before adopting any of them.
How the Extraction Works
A photo contains tens of millions of colour values — noise around a few dozen real ideas. The algorithm's job is clustering: quantise or sample the pixels, group similar colours, and rank the groups by how much of the image they explain. The common approaches — k-means iterating toward representative centroids, median-cut splitting the colour cube along its widest axis (the same lineage as GIF's own palettes), octree merging in octant trees — differ in speed and in how they treat rare-but-important colours, and all answer the honest question: which colours are there, and how much of each?
The consequence users are surprised by: results are weighted by area, not meaning. A portrait against a grey wall produces a grey-dominated palette because grey is most of the file. If you want the subject's colours, crop to the subject first — the crop is the question you are actually asking.
Reading the Output
A palette tool returns the swatches with HEX (#3B82F6) and RGB values, usually ordered by dominance and sometimes with proportions. HEX is the design-tool and CSS currency, RGB the code and canvas currency; both refer to the same sRGB colour. What neither tells you — and what you must check before adopting a colour — is whether text sits legibly on it: a mid-tone that looks perfect in a swatch row can be a WCAG disaster at body-copy sizes.
The perceptual trap worth knowing: extraction is maths on pixels, and pixel distances are not perceptual distances. Two swatches three RGB steps apart may read as identical (and waste a slot), while a perceptually distinct pair sits far apart in values the clustering treats as one (and never appears). If a colour you can see in the image is missing from the palette, it is probably in the minority — crop tighter and extract again at higher k.
From Swatches to a Scheme
Six colours from a photo are not a design system; the mapping is where taste enters. Take the largest cool-toned area as the surface/neutral, the mid-dominant as the secondary structure, the smallest high-chroma area as the accent — that is the 60-30-10 skeleton wearing the photo's clothes. Every one of them needs a neutral companion for text; if the image yields none, derive one by desaturating the dominant hue to near-white and near-black rather than defaulting to #FFF and #000, which sit visibly harsh against a warm scheme.
For brand matching — extracting the colours of a product photo, a venue, a client's existing environment — the same logic applies with an extra step: convert to HEX and check the values against the brand's real palette, because extraction gives you the colour as photographed, and a warm tungsten cast has shifted everything toward orange that the print swatch does not contain. Colour-managed extraction (sampling before any cast correction) is a different report than 'what the brand thinks its colour is'.
What to Extract From (and What to Skip)
Best sources: film stills and music artwork, because they were colour-graded by professionals — extracting from them is borrowing a colourist's decisions; landscapes and city photography, which contain naturally harmonised hues (the physics of shared light does the coordination for you); interiors and product shots, where the palette is literally a designed palette.
Worst sources: images with heavy JPEG artefacts (the banding around edges invents colours that do not exist in the scene — compressing first stabilises the clusters), screenshots of UIs (already limited to brand hues; extraction gives you the brand's own colours back with more noise), and any gradient-heavy image, where every intermediate value is real, present, and not a colour anyone would choose.
Practical Workflows
The website hero: extract from the exact photo you are about to ship, take the three largest areas as surface and structure, and the three smallest saturated ones as accent candidates; then build the hero layout using the palette's own colours for the overlay, the button and the headings — the design matches the image because it is the image, which is why the technique reads as 'cohesive' when nobody can say why.
The mood board: extract from each reference, line the palettes side by side, and look for the recurring hue families across shots — that recurring cluster is the brief the photographer or art director was actually following, written in HEX. The whole exercise is three minutes with a batch of images and the extractor.
Frequently asked questions
The questions people ask most about how to extract a color palette from an image, answered directly.