What does extracting a color palette from an image mean?
Extracting a palette means finding the few colors that best summarize a picture. A photo of a sunset has millions of slightly different pixels, but a designer sees four or five: a deep blue, an orange, a pink, a dark brown. This tool does that calculation for you and returns the dominant colors as HEX codes, each with the percentage of the picture it covers, sorted from the most to the least present.
You use it to build a color scheme for a site or slide deck from a photo or logo, to match an interface to a product picture, to give a blog post a theme that follows its cover image, or to hand a designer the main colors of a reference. You choose how many colors you want, from 3 to 12. Click any color to copy its HEX code, copy all of them as CSS variables, or download the palette as a PNG strip plus a CSS file.
The tool works on one picture at a time and runs in your browser: the picture is not uploaded, there is no account and no watermark. To pick the exact color of one specific point instead, use Image color picker.
How to get the colors of an image
- Drop a picture on the page, click the file button or paste one with Ctrl+V. JPG, PNG, WebP, BMP, GIF, HEIC and AVIF are accepted, one picture at a time. An example photo is loaded first.
- Move Number of colours between 3 and 12 (6 by default). The swatches update as you move the slider.
- Read the swatches: each shows its HEX code and the share of the picture it covers, in percent. Text on each swatch switches between black and white so it stays readable.
- Click a swatch to copy its HEX code; it says Copied for a moment. Press Copy as CSS variables to copy all of them as
--color-1,--color-2and so on. - Press Download the palette to get two files: a PNG strip with one 120 px wide square per color, and a
.cssfile with the variables, named after your picture, for examplesunset-palette.pngandsunset-palette.css.
Examples
Palette from a landscape photo
sunset.jpg, 4000 × 2667, 6 colors. A result could look like this, ordered by share:
| Swatch | HEX | Share |
|---|---|---|
| 1 | #1c2a4a | 31% |
| 2 | #e8793a | 22% |
| 3 | #f2b47c | 15% |
| 4 | #7a3b4c | 12% |
| 5 | #0d1220 | 11% |
| 6 | #c25a5a | 9% |
The values depend on the picture; what is fixed is the order, from the largest share to the smallest.
Colors for a CSS file
With 4 colors, Copy as CSS variables gives:
:root {
--color-1: #1c2a4a;
--color-2: #e8793a;
--color-3: #f2b47c;
--color-4: #7a3b4c;
}Rename the variables to --brand, --accent and so on after pasting.
Size of the downloaded strip
Each color becomes a 120 × 120 px block, side by side. With 6 colors the PNG is 720 × 120; with 12 colors, 1440 × 120; with 3 colors, 360 × 120.
A flat picture
A solid red #ff0000 image has a single color. Asking for 6, the tool shows one swatch and the message "The picture only has 1 colour, fewer than the 6 you asked for."
Common errors and how to fix them
- "Could not read this picture.": the file is damaged or not a supported image. Open it in a viewer and export it as PNG or JPG.
- The first color is white or gray and not what you wanted: dominant means most frequent. A product photo on a white background gives white first. Crop the picture with Crop image before extracting, or raise the number of colors.
- Two swatches look almost the same: the picture has a gradient, and the algorithm splits wide ranges. Lower the number of colors to merge them.
- "The picture only has N colours, fewer than the M you asked for.": not an error. The picture has fewer distinct colors than the slider asks for.
- Transparent areas are missing: pixels that are mostly transparent are ignored, so a logo with a transparent background does not return a "transparent" color.
Frequently asked questions
How does the tool decide which colors are dominant?
It makes a small copy of the picture (at most 160 px on the long side), groups similar colors and then splits the groups with a median cut: the group with the widest spread of values is divided until it reaches the number you asked for. Each swatch is the average of the pixels in its group. The same picture and number always give the same result.
Is median cut better than picking colors by hand?
They answer different questions. Median cut summarizes the whole picture quickly and in a repeatable way. Picking by hand is better when you need the exact color of a particular spot, such as a logo.
Is it free, and is my image uploaded?
It is free, with no account. The picture is processed in your browser and does not leave your device.
Does it work on phones?
Yes. The page adapts to narrow screens and you can pick a photo from the gallery.
Can I use the palette in Tailwind, SCSS or JSON?
This page copies CSS variables. Image color picker also exports the dominant colors as Tailwind, SCSS, JSON and a HEX list, and shows the contrast against white and black text.