Image Color Extractor
Drop any image to pull its dominant colors as a palette. Uses median-cut and k-means quantization on the canvas — runs fully in your browser, no uploads, no tracking.
- Drag-and-drop or paste — JPG, PNG, WebP, AVIF, GIF
- Median-cut + k-means quantization for dominant color picks
- Per-color frequency and HEX / RGB / HSL output
- 100% client-side — the image never leaves your browser
Direct answer
Image Color Extractor
Drop an image here
or click to upload (PNG, JPG, WebP — processed locally)
When this saves you time
Real workflows where image color extractor replaces tedious manual work or an in-app subscription tool.
Reverse-engineer a moodboard
Match a layout to a hero photograph
Generate product tag colors automatically
Audit an existing app's effective palette
Build a limited palette from a reference
Match typography color to the cover photo
How it works
The methodology — every transformation documented so the output is reproducible.
Load the image into a canvas
The browser decodes the file and draws it onto an offscreen canvas. We downsample large images to ~150×150 so quantization stays fast — pixel position doesn't matter, only color distribution.
Median-cut to bootstrap the palette
Median-cut recursively splits the RGB color cube along its longest axis until each cell contains a manageable cluster of pixels. The cell centroids are the initial palette.
k-means refine
Median-cut centroids seed a k-means iteration: each pixel is reassigned to its nearest centroid, centroids are recomputed, and the process repeats until stable. This shifts cluster centers off the median-cut grid toward perceptually weighted positions.
Sort by frequency
Colors are ranked by the number of pixels assigned to each cluster, giving you a dominance-ordered palette. The largest cluster is the photo's 'mood' color; the smallest is usually an accent or highlight.
Worked examples
| Input | Result | Notes |
|---|---|---|
| Sunset beach photograph (5 colors) | #1E3A8A, #F97316, #FCD34D, #FFF7ED, #312E81 | Two-tone sky split (deep blue + orange), plus warm sand and a dark silhouette accent. |
| Forest landscape (8 colors) | #1B3A1B, #4A6B3A, #8FA68F, #D4C8B0, #5C4D3A, #2D2419, #B5C7A8, #F5F1E8 | Multiple green tiers from canopy to undergrowth, plus warm earth tones for trunks and soil. |
| Brand SaaS dashboard screenshot | #FFFFFF, #F8FAFC, #1E293B, #3B82F6, #10B981 | Two near-whites (surface + card), one body text near-black, the brand blue, and a success green. |
| Renaissance painting reference | #3A2818, #8B5A2B, #C9A87C, #2C3E50, #ECC97D | Earth-tone heavy palette: bitumen shadows, ochre midtones, and a gold leaf highlight. |
Common mistakes to avoid
Picking too many colors
Assuming dominant = important
Sampling JPEGs blindly
Forgetting the source uses a wider gamut
Frequently Asked Questions
Why quantization is the right approach
A naive “dominant color” algorithm picks the most frequent pixel value. That works on flat illustrations but collapses on photographs, where every pixel is unique due to sensor noise and JPEG compression — you'd extract one arbitrary pixel and miss the actual mood. Quantization solves this by grouping similar pixels into clusters, then returning each cluster's representative center.
Median-cut (Heckbert, 1982) is the classic algorithm used in the GIF palette generation step. It builds a balanced binary tree by splitting the color cube along its longest axis at the median pixel, recursively, until you have the desired number of leaves. It's O(N log K), deterministic, and produces visually reasonable palettes. K-means refines the result by minimizing the sum of squared distances from each pixel to its assigned centroid. The combination is faster than pure k-means (because median-cut seeds it well) and more perceptually faithful than median-cut alone.
Color spaces and perceptual weighting
All the math happens in sRGB by default — the space the image was encoded in. For perceptually-weighted extraction (giving more weight to hue differences than channel differences), we can quantize in OKLab instead. The trade-off: OKLab is slightly slower, but pulls out hues your eye notices over mathematically-distant-but-perceptually-similar pixels.
From extracted palette to design system
The extracted palette is a starting point. From here you typically refine the colors (snap to the nearest sensible HEX), generate harmonies via the palette generator, build the 11-step ramps with the Tailwind palette generator, and freeze the result as design tokens. The extractor is most useful at step zero of brand or moodboard work; by the time you ship, the extracted colors will have been refined heavily.