How to extract a color palette from an image

You are building a look for your store and want colors that suit your products, or a product page in colors taken from the product itself. Instead of trying colors one by one, extract them straight from the picture.

Published · 2 min read

What you get

You get the most present colors in the image, from 2 to 12, sorted by the share of the area each one covers. The same settings give the same result every time, so there are no surprises.

Worked example

An image that is half pure red and half pure blue, with 2 colors selected.

Result: #FF0000 at 50% and #0000FF at 50%.

The white background problem

A product on a white background will give you white as the biggest color, which is no use. Turn on “Ignore near-white” and the product's own colors show up. Near-white here means all three channels are 245 or more. There is a matching option for black, and another to ignore transparent pixels in logos.

How to do it

  1. Open the Image palette extractor extractor and choose your image.
  2. Set the number of colors and the size of the analysed sample.
  3. Turn on ignoring transparent, white or black pixels if the background dominates the result.
  4. Copy any color, or download the whole palette as JSON, CSS variables, a PNG strip or a GPL file.

The result is an approximation, and that is normal

The algorithm groups similar colors and shows the average of each group. So a palette color may not exist literally in any pixel, and a small area of color can merge into its neighbor. If you need the exact color of one point, use the Image color picker.

Details worth knowing

  • The image is reduced to the sample size you choose, 100, 200 or 400 pixels on the longest side, before analysis.
  • Shares are rounded to one decimal, so they may not add up to exactly 100.
  • The tool does not suggest matching colors or check contrast. To check text readability on your colors, use the Color contrast checker.
  • Tested limits: 40 MB and 50 megapixels per image.

Common questions

Can I use the colors directly on my site?

Yes. Download them as CSS variables and paste them into your stylesheet, or copy each color's HEX value.

Why does a small color in the picture not appear?

Small areas can merge into a neighboring color. Raise the number of colors or the sample size and more detail shows up.

Is the image uploaded?

No, the analysis runs inside your browser.