ImgSprint

Extract a Color Palette from Any Image New!

Get a color palette from image files: extract the dominant colours of any photo as HEX and RGB swatches, then copy them or export CSS. No upload needed.

Colour palette extractor

Select image

or drop an image here

JPG, PNG, WebP, AVIF, GIF

How to use the Color Palette Extractor

  1. 1

    Add an image

    Drop a photo, logo, illustration, or screenshot.

  2. 2

    Pick how many colours

    Choose 3 to 12 swatches. The palette is recalculated instantly.

  3. 3

    Copy what you need

    Click any swatch to copy its HEX code, or copy RGB values from the list.

  4. 4

    Export

    Download the palette as CSS variables, JSON, or a PNG swatch card.

What you can do

Smart clustering

A k-means algorithm groups similar pixels, so you get the colours that actually dominate — not random samples.

One-click copy

Copy HEX or RGB for any swatch, or the whole palette at once.

Developer exports

Ready-to-paste CSS custom properties, Tailwind-friendly JSON, and a shareable PNG card.

Runs locally

The image is analysed in your browser — nothing is uploaded.

Turning a photo into a colour palette

Every great palette starts somewhere — a sunset, a product shot, a competitor’s landing page, a painting you love. This tool reads every pixel of your image and finds the handful of colours that best describe it. Under the hood it uses k-means clustering: it places a few “centres” in colour space, assigns each pixel to the nearest one, moves each centre to the average of its pixels, and repeats until nothing moves. The result is a set of representative colours plus the share of the image each one covers.

Getting a useful palette

  • Crop first. If you only care about a product or a logo, crop away the background so it does not dominate the palette.
  • Start with five or six colours. That is enough for a primary, secondary, accent, and two neutrals. Go higher for illustrations with many hues.
  • Check contrast. Palette colours are averages, so they are often mid-tones. For text, pair the darkest and lightest swatches and confirm a contrast ratio of at least 4.5:1.
  • Need an exact pixel? Use the image colour picker to sample a precise spot.

Using the exports

CSS variables drop straight into a stylesheet (--color-1: #0D9488;), and the JSON export works with design tokens, Tailwind config files, or Figma plugins. The PNG card is handy for mood boards and client presentations: it shows each swatch with its HEX code underneath. Like every ImgSprint tool, the analysis happens on your device — your image is never uploaded.

Frequently asked questions

How are the dominant colours chosen?

The image is shrunk to about 200 pixels on its longest side and every pixel is grouped with k-means clustering (seeded with k-means++). Each swatch is the average colour of one group, and the percentage shows how much of the image that group covers.

Why does the palette change when I change the number of colours?

With more clusters, large areas split into finer shades; with fewer, similar shades merge. Try 5–6 colours for a brand palette and 8–12 for illustration work.

Are transparent pixels counted?

No. Pixels that are mostly transparent (alpha below 50%) are ignored, so a logo on a transparent PNG gives you just the logo colours.

What is the difference between this and the Image Color Picker?

The Color Picker samples the exact colour under your cursor. The Palette Extractor analyses the whole image and summarises it into a handful of representative colours.

Can I use the colours commercially?

Colours themselves cannot be owned, so yes. Just make sure you have the rights to use the source image itself if you publish it.