A photo you like is often the quickest route to a color scheme: a sunset, the walls of a cafe, a painting each already holds colors that work together. A palette extractor turns those colors into codes you can paste into a design tool, a stylesheet or a brief.
The Color Palette from Image tool does it in your browser, without uploading the picture. This guide covers how to use it, what is happening under the hood, and how to get a palette that is actually useful rather than five shades of beige.
Getting a palette, step by step
- Open the Color Palette from Image tool and drop in a PNG, JPG or WebP, or click to choose one. The palette appears straight away.
- Set the number of colors with the slider, anywhere from 2 to 12. Six is the default and a good starting point for a website or brand scheme.
- Choose Dominant to get the colors that cover the most of the picture, or Distinct to spread the swatches out so small accents get a place.
- Click a swatch to copy its HEX code, or click any HEX, RGB or HSL value in the table underneath. The Share column shows how much of the picture each color stands for.
- Pick an export format - a plain HEX list, CSS variables, SCSS or JSON - then copy it or download it as a file. Download palette PNG saves a swatch strip with each code printed on it.
Swatches can be ordered by share or from light to dark, which reads the palette as a range of tones.
How the colors are chosen
A 12-megapixel photo contains millions of pixels and often hundreds of thousands of distinct colors, so a palette has to be a summary. The tool first works from a copy of the image scaled down to 300 pixels on its longest side - around 90,000 pixels, which is plenty for shares accurate to a fraction of a percent - and skips any pixel that is more than half transparent, so a cut-out logo's empty background does not turn up as a swatch.
It then groups similar pixels together with k-means clustering: it finds the number of groups you asked for so that every pixel is as close as possible to its group's average. Each swatch is that average, and its share is the fraction of pixels in the group. The result is deterministic - the same image and settings always give the same palette.
Why it measures color in Oklab, not RGB
"As close as possible" depends on how you measure the distance between two colors, and RGB numbers are a poor ruler. Take black, rgb(0, 0, 0), and add 60 to just one channel. To RGB arithmetic, rgb(0, 60, 0) and rgb(0, 0, 60) are exactly the same distance from black - 60 units each. To the eye the dark green is clearly further from black than the dark navy, because we are far more sensitive to green light.
Oklab is a color space designed so that straight-line distance matches how different two colors look. In Oklab that dark green sits 0.326 away from black and the navy 0.196 - the green step is about two-thirds larger, which matches what you see. Clustering in Oklab is what stops a palette tool merging navy into black, or spending three swatches on blues you can barely tell apart while a visibly different green goes unrepresented.
Dominant or distinct?
The two modes answer different questions, and the right choice depends on what the palette is for.
- Dominant answers "what is this picture mostly made of?" It is the better choice for matching the overall mood of a photo - picking a page background that sits well with a hero image, for example.
- Distinct answers "what different colors are in here?" It first breaks the image into about three times as many groups as you asked for, keeps the largest, and then repeatedly adds whichever group is furthest from the colors already chosen, with a gentle preference for bigger groups so a few stray pixels cannot win. Every pixel is then counted again against the final colors, so the shares still add up to 100%.
A worked example
To see the difference, we built a test image: a blue sky covering about 56% of the pixels, sand covering 42%, a dark shadow at 1.2% and a red beach umbrella at just 1%. Asked for four Dominant colors, the tool returned the sand (#D3B181, 43.2%), two blues for the sky (#5B83DE at 29.0% and #5DABD9 at 26.5%) and the shadow (#141414, 1.2%). The umbrella vanished: its pixels were folded into the sand, which is why the sand's share is a point higher than the sand alone.
Switched to Distinct with the same four slots, the result was one sky blue (#5C94DE, 51.5%), the sand (#CAB589, 46.3%), the shadow (1.2%) and the umbrella red (#E61428, 1.0%). Dominant is an honest summary of area; Distinct is the one that remembers the umbrella. Asking Dominant for six colors would also bring the red back, at the cost of extra blues and sands.
Picking one exact pixel
A palette color is an average, so it rarely matches any single pixel. That is a feature for a mood board, but not when you need one specific value - a logo's brand color, the exact shade of a button in a screenshot. For that, use the picker under the palette: click anywhere on the image and the tool reads that pixel's precise color from the full-resolution original, not from the scaled-down preview, and shows it as HEX, RGB and HSL with copy buttons. If the pixel is partly transparent it says how opaque it is.
On photos, edges, JPG compression and camera noise mean neighbouring pixels can differ by several units, so click in the middle of a flat area rather than on a boundary.
Using the palette in a design
- CSS variables export as a :root block with --color-1, --color-2 and so on, ready to paste into a stylesheet and rename to something meaningful like --brand or --surface.
- JSON gives an array of HEX strings for design tokens or a script; SCSS gives $color-1 style variables.
- Check contrast before using two palette colors as text and background. Colors pulled from one photo often sit close together in lightness, which looks harmonious but can fail readability guidelines. The swatches already print their labels in whichever of black or white reads better, which is a quick hint.
- To convert a single code into other formats such as CMYK, paste it into the color converter.
Getting a better palette
- If one area dominates and crowds everything out, crop to the part you care about first with Crop Image, or switch to Distinct.
- If two swatches look almost identical, the image simply does not have that many different colors. Lower the count rather than forcing it.
Extract your palette now
Drop in a photo, choose how many colors you want, and copy the codes. Open the Color Palette from Image tool - free, no sign-up, and nothing ever leaves your browser.
Frequently asked questions
- How do I find the HEX code of a color in an image?
- Load the image into the Color Palette from Image tool and click the spot you want on the picture below the palette. The picker reads that exact pixel from the full-resolution image and shows its HEX, RGB and HSL values with copy buttons. Click in the middle of a flat area, since edges and compression noise make neighbouring pixels vary slightly.
- How many colors should a palette have?
- For a website or brand scheme, five or six is the usual range: a background, a surface, one or two text tones and an accent or two. Fewer than four rarely captures a photo's character; more than eight tends to repeat near-identical shades. If the swatches start looking alike, the image does not hold that many distinct colors, so lower the count.
- Why does my palette not include a small bright detail?
- Because Dominant mode chooses colors by how much of the picture they cover, and a detail that occupies 1% of the pixels is cheaper to fold into its nearest large neighbour than to give its own slot. Switch to Distinct, which deliberately picks colors that are far apart, or raise the number of colors until the detail appears.