Extract the dominant colors of an image

extract the dominant colours from an image and build a ready-to-use harmonious palette (HEX, RGB, HSL). Ideal to derive a brand style or draw inspiration from a photograph

Why use a colour palette extraction tool?

Extracting a colour palette from a photo is essential for designers and developers. This tool simplifies the process by letting you quickly and accurately extract the dominant colours from an image, grouping similar colours together, making it easier to build harmonious colour palettes for your projects.

Features of the colour palette extraction tool

This colour palette extraction tool lets you upload a photo and extract the dominant colours from the image. It uses a clustering algorithm to group similar colours, letting you instantly get a harmonious colour palette for your design and development projects.

How to use the colour palette extraction tool

To use the colour palette extraction tool, follow these simple steps:

  1. Upload a photo with the provided form.
  2. Click the "Extract" button. The tool will analyse the image and display the extracted colour palette, grouping similar colours.

Example use of the colour palette extraction tool

Here is an example of a colour palette extracted from a photo:

#cececc

#262123

#daad90

#229fbd

Frequently asked questions

Which image formats are accepted?

The extractor accepts the classic web bitmap formats: JPG, JPEG, PNG, GIF and WebP. Vector images (SVG) are not relevant for this processing, since they already describe their colours in the code. For an SVG file, open it in a text editor and read the HEX values directly from the fill and stroke attributes.

What is the maximum image size accepted?

Files up to about 10 MB go through without issue. Beyond that, processing is still possible but slows down noticeably. To speed up extraction on a very high-resolution photo, resize it to roughly 1500 px wide: the dominant palette stays the same, but the analysis is much faster.

What is the difference between a palette extractor and a colour picker?

A colour picker returns the colour of a specific pixel targeted with the mouse. The palette extractor analyses the entire image, groups visually close pixels by clustering, then returns the n dominant colours. The picker is useful to point at a detail, the extractor to grasp the overall chromatic mood of a photo.

How does the algorithm group colours?

The tool uses a k-means style clustering in the RGB space: each pixel is matched to the nearest class centre, then centres are recomputed at each iteration until stabilisation. The result is a list of representative colours, expressed in HEX, that summarise the image without noise.

Is my image stored on the server?

The image is sent to the server during the pixel-by-pixel analysis, then destroyed immediately after the palette is extracted. No file is kept on disk. EXIF metadata (geolocation, camera model) is not used and disappears with the original file.

What is an extracted palette actually used for?

There are many uses: align a brand identity with a product photo, recolour a shop to match the mood of a hero visual, feed a dark theme from an artwork, or generate design tokens in a CSS, SASS or Tailwind file. The resulting palette can then be refined in the palette generator or converted with the colour converter.

Example request

curl -X POST https://cdrn.fr/api/v1/tools/color-extractor/execute \
  -F "image=@/path/to/file" \
  -F "number=1"

Input schema

Field Type Required Default
image file
number integer

this tool expects a file - use Content-Type multipart/form-data instead of application/json

Endpoints

  • GET https://cdrn.fr/api/v1/tools - lists every available tool
  • GET https://cdrn.fr/api/v1/tools/color-extractor - returns the schema for this tool
  • POST https://cdrn.fr/api/v1/tools/color-extractor/execute - runs this tool with a JSON payload