Color Palette from Image
Upload a photo, artwork or screenshot and instantly get its dominant colors. Choose how many colors you want, compare two extraction methods, then copy the HEX codes, CSS variables or Tailwind colors, or download the palette as an image.
Last updated:
How to use the Color Palette from Image
- Add an image: drop it on the box, paste it with Ctrl+V, or press Choose image. A sample photo is loaded so you can try the tool right away.
- Pick the number of colors (3 to 12) with the slider. The palette updates instantly.
- Choose a method: K-means finds the colors that best represent the whole image; Median cut is faster and keeps more small accent colors.
- Copy the colors: click a swatch to copy its HEX code, or choose a code format and press Copy code.
- Download the palette as a PNG image to share it or keep it as a mood board.
K-means vs median cut
| K-means (Lab) | Median cut (RGB) | |
|---|---|---|
| How it works | Starts from well-spread seed colors (k-means++), then repeatedly assigns every pixel to the nearest color and moves each color to the average of its pixels until nothing changes. | Puts all colors in one box, then keeps cutting the box with the most pixels (later: most pixels × widest spread) in half at the median of its widest channel. |
| Color distance | CIELAB, designed so equal distances look roughly equally different to the eye | RGB channel ranges |
| Strength | Colors that best represent the image as a whole; stable, balanced palettes | Keeps small but distinct accent colors, such as a red flower in a green field |
| Best for | Photos, brand palettes from product shots, mood boards | Illustrations, posters, logos and images with a few strong accents |
Both methods analyze a scaled-down copy of up to about 40,000 pixels, which is plenty to capture the color distribution while keeping results instant. Results are deterministic: the same image and settings always give the same palette.
Turning an image palette into a usable color scheme
- Pick a dominant and a neutral. The color with the largest share is often a background or sky. Pair it with the darkest or lightest neutral for text.
- Check contrast before using colors for text. WCAG asks for a contrast ratio of at least 4.5:1 for normal body text and 3:1 for large text.
- Use accents sparingly. A common rule of thumb is 60% dominant color, 30% secondary color and 10% accent.
- Need more shades? Paste a HEX code into a shades or Tailwind color generator to build a full 50 to 900 scale from one extracted color.
Frequently asked questions
How does the tool find the main colors of an image?
It reads the pixels of a scaled-down copy of your image and groups similar colors together. With k-means, colors are clustered in the CIELAB color space, which matches human color perception better than RGB, and each cluster's average becomes one palette color. Median cut repeatedly splits the set of colors along its widest channel until there are as many boxes as colors you asked for.
Is my image uploaded?
No. The image is opened and analyzed entirely in your browser with the Canvas API. Nothing is sent to a server, so it is safe for private photos and unreleased designs.
Why are the colors slightly different from a single pixel I pick?
Each palette color is the average of a whole group of similar pixels, so it represents an area of the image rather than one exact pixel. To read the exact color of one spot, use an image color picker instead.
What do the percentages mean?
They show what share of the image's pixels belong to each color group. A background color usually has the largest share, while small accent colors may have only 1 to 3%.
How many colors should I extract?
For a website or brand palette, 5 or 6 colors is a good start: one or two dominant colors, a neutral and a few accents. Use 8 to 12 colors to capture more detail from colorful illustrations.
Are transparent pixels counted?
No. Pixels that are mostly transparent (alpha below 50%) are ignored, so logos and icons on a transparent background give a palette of only their visible colors.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.