Skip to main content

Image Tools

Color Palette Extractor

Extract dominant colors and generate palettes from any image. Free online tool — no upload, no sign-up, runs entirely in your browser.

See how to use this tool

Color Palette Extractor

Extract dominant colors and copy palette values.

About Color Palette Extractor

ToolConv's color-palette extractor reads any image and returns its dominant colors using a k-means clustering pass over downsampled pixels, then exports them as hex, RGB, HSL, and a ready-to-paste CSS custom-property block. Designers use it to build a brand palette from a hero photograph; developers use it to seed Tailwind or CSS variable themes without guessing. Because the image is processed entirely in-browser via Canvas getImageData, you can run it on confidential product shots or client mood boards without anything leaving your machine.

Beyond the top-N palette, the tool reports the average color, the most saturated color, and a WCAG contrast ratio against white and black for each swatch — so you can immediately tell whether a brand red will pass AA as body text. You can lock individual colors to re-cluster the rest, and copy any swatch with one click.

How to use it

  1. 1Upload the image you want to extract colors from.
  2. 2Set how many colors you want (default 6; range 3–12).
  3. 3Optionally lock a swatch and re-cluster to refine the palette around it.
  4. 4Check each swatch's WCAG contrast against white/black for accessibility.
  5. 5Copy a single hex, or export the whole palette as CSS variables.

When to use it

  • ✓Deriving a 5-color brand palette from a hero photograph for a new landing page.
  • ✓Generating a Tailwind config from a client's existing logo PNG.
  • ✓Checking whether a button color meets WCAG AA contrast against the page background.
  • ✓Building a mood-board color reference for a design system documentation page.

Features

  • •k-means clustering with adjustable cluster count (3–12 colors).
  • •Outputs hex, RGB, HSL, and a copy-ready CSS custom-property block.
  • •WCAG contrast ratio displayed for each swatch against white and black.
  • •Lock-and-recluster so you can refine a palette around a must-keep color.

Related tools

FAQ

Are my images uploaded to extract the palette?

No. The image is read into a Canvas and sampled with getImageData, all locally. You can extract palettes from unreleased product photos without any data leaving your device.

Which algorithm is used to pick the colors?

k-means clustering on a downsampled pixel set (typically 10k–50k pixels) in RGB space, with a fixed random seed so the same image always yields the same palette.

Can I export colors directly into my CSS?

Yes. The 'Export CSS' button copies a :root block with --color-1 through --color-N custom properties, ready to paste into your stylesheet.

Why does a brightly colored photo give me muddy colors?

k-means minimizes overall distance, so large neutral areas (sky, walls) can dominate. Reduce the cluster count, or lock a vivid swatch and re-cluster so the algorithm has to fit around it.

Does the tool handle transparency in PNGs?

Yes. Fully transparent pixels are excluded from clustering, so a logo with a transparent background yields colors from the actual artwork, not from the alpha channel.

Is the WCAG contrast calculation accurate?

Yes, it uses the standard relative-luminance formula from WCAG 2.1. Note it measures text-on-background contrast; for large UI fills you should also consider the surrounding context.