Skip to main content
The Extract view analyzes an image and pulls out its most representative colors using a k-means clustering algorithm. Everything runs in your browser — no image is uploaded to a server.

Opening the Extract view

Press X to jump directly to the Extract view from anywhere in the app.Alternatively, press G to cycle through the available views (palette → gradient → extract) in order.

Loading an image

The Extract view shows a 16:9 drop zone.
1

Drop or pick an image

Drag an image file directly onto the drop zone, or click the drop zone to open the file picker. Supported formats: PNG, JPG, GIF, WEBP — any format the browser’s <img> element can decode.
2

Wait for extraction

A brief “extracting colors…” message appears while the algorithm runs. On most images this completes in under a second.
3

Review the extracted swatches

Up to 10 color swatches appear below the image preview. All swatches start selected (highlighted with a ring).

How extraction works

The algorithm uses the browser’s Canvas API and k-means clustering entirely client-side:
  1. Scale — the image is drawn onto a <canvas> scaled to a maximum of 150 px on its longest side. This limits the number of pixels processed and keeps the algorithm fast regardless of the original image resolution.
  2. Sample pixels — every third pixel is sampled (step of 4 × 3 bytes in the raw RGBA buffer), and only pixels with an alpha value above 128 are included. Transparent areas are ignored.
  3. Cluster — the sampled pixels are clustered into k = 10 groups using k-means in RGB space. The algorithm initializes centroids by evenly spacing them through the pixel array, then runs up to 20 iterations or until no centroid moves.
  4. Return centroids — the final centroid of each cluster is converted to a hex value and displayed as a swatch.
Because k-means uses a deterministic initialization (evenly spaced pixels, not random), the same image always produces the same 10 colors.

Selecting swatches

After extraction, you choose which colors to add:
InteractionResult
Click a swatchToggle its selection on or off
Click and drag across swatchesToggle a range in one gesture — the first swatch you click sets the direction (select or deselect), and dragging applies that same operation to every swatch you cross
Deselected swatches appear at reduced opacity. The Add N colors button reflects the current selection count.

Adding colors to the palette

Click Add N colors to palette to move the selected colors into your palette.
If your palette already contains 10 colors (the maximum), adding extracted colors replaces the entire palette with the selected swatches. No merge takes place — the existing palette is cleared first.If you want to keep some existing colors, lock them before switching to the Extract view, or add the extracted colors when the palette has room.
When the palette has fewer than 10 colors, the extracted colors are appended up to the 10-color limit. If you select more colors than there is room for, the extras are silently dropped.

Supported image types

Any image format supported by your browser works: PNG, JPG/JPEG, GIF, WEBP, AVIF, BMP, SVG. Animated GIFs use the first frame.
Color extraction reads pixel data using canvas.getContext('2d').getImageData(). Browsers block this for cross-origin images due to the canvas taint policy. Use locally loaded files (drag-and-drop or file picker) to avoid this restriction.

Eyedropper

Pick a single color from anywhere on screen and add it to your palette.

Generating palettes

Generate palettes from scratch using color theory relationships.

Locking colors

Lock colors before extracting to preserve your existing choices.

Keyboard shortcuts

X and G shortcuts for navigating to Extract view.

Build docs developers (and LLMs) love