# Image Color Palette Extractor

URL: https://hifreetools.com/color/image-palette-extractor

> Upload an image and instantly extract its dominant color palette plus the overall average color, each shown as a swatch with a copyable HEX code.

## Quick answer

To extract a palette, this tool samples the pixels of your image, groups similar colors together, and surfaces the most common ones plus the image's average color. Each palette color is shown as a swatch with its HEX code and the share of pixels it represents. It runs entirely in your browser, so the image is never uploaded.

The image is drawn to a small canvas (scaled down for speed) and every mostly opaque pixel is read with getImageData. Pixels are grouped into buckets by reducing each channel to 32 levels, and the buckets with the most pixels become the dominant palette, each averaged back to a representative HEX. The overall average color is the mean of all sampled pixels.

## Examples

- Palette from a photo: Upload a landscape photo → Up to 8 dominant HEX colors + average
- Brand colors from an image: Upload a poster → Its main colors with pixel shares
- Average tone: Any image → One average HEX color

## FAQ

**How does it find the dominant colors?**
It samples the image's pixels, groups similar colors into buckets, and picks the buckets containing the most pixels. Each is averaged into a representative HEX shown with its share of the image.

**How many colors does it extract?**
Up to eight dominant colors, ranked by how much of the image they cover, plus a single overall average color.

**Is my image uploaded?**
No. The image is processed entirely in your browser with the canvas API, so it never leaves your device.

**Why don't the colors exactly match the original?**
Each palette color is an average of a group of similar pixels, and the image may be compressed, so the result is representative rather than pixel-perfect. Use the Image Color Picker to read one exact pixel.

**What is the average color useful for?**
It is the mean of all pixels and works well as a matching background tint or a single accent, though it can look muted compared with the dominant swatches.

**Does it handle transparent images?**
Yes. Pixels under about 50% opacity are skipped so they don't distort the palette, and only visible colors are counted.


## Sources

- [MDN — CanvasRenderingContext2D.getImageData()](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/getImageData)
- [Wikipedia — Color quantization](https://en.wikipedia.org/wiki/Color_quantization)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Image Color Palette Extractor", https://hifreetools.com/color/image-palette-extractor
