GamutDesk Logo
GamutDesk

Image Dominant Palette Extractor

Extract 6 dominant theme colors from any image using Web Worker K-Means clustering. Images are processed locally in your browser and are not uploaded to our servers.

Client-Side ArchitecturePrivate Client-Side Processing
PNG, JPEG, WebP
Web Worker Off-Thread

Upload an image above to extract its 6-color dominant theme

6 Extracted Dominant Palette Swatches (Click to Copy)

Technical Specification & Mathematical Principles

The algorithm minimizes within-cluster sum of squares (WCSS): arg min Σ Σ ||x - μ_i||² where x represents sampled pixel vectors [R, G, B] and μ_i are centroid vectors.

Pixels with alpha transparency below 50% are automatically pruned from the dataset to avoid bias from transparent PNG borders.

Need single-pixel precision rather than bulk clusters? Launch our image eyedropper pixel picker to sample exact coordinates, or combine your extracted palette stops to build linear CSS gradients.

Frequently Asked Questions

How does the K-Means clustering algorithm extract dominant colors?
K-Means groups tens of thousands of image pixels into 6 distinct spatial clusters in Euclidean color space, iteratively computing their average centroids until variance stabilizes to identify genuine visual anchors.
Why does extraction use a Web Worker?
Computing distance matrices for high-resolution images is CPU-intensive. Moving computation to a Web Worker background thread prevents dropped frames, ensuring the user interface remains 60fps responsive.
Is there any quality loss from downscaling during extraction?
No. Statistical color clustering on an 800px sampled canvas produces identical centroid distributions as a 4000px raw canvas, but executes in under 50 milliseconds rather than seconds.

Related Design & Color Instruments