Image Color Extractor — Sampled HEX, RGB and HSL Palette

Image Tools

Loading tool...

About This Tool

Extract an approximate palette from an image, view sampled color percentages and copy HEX values or export JSON. Choose up to 20 representative colors.

How to Use

  1. Select a PNG, JPEG, WebP, GIF or BMP image up to 20 MiB.
  2. Choose a maximum palette size from 2 to 20.
  3. Extract and inspect representative colors and percentages.
  4. Click a color to copy its HEX value, copy the list or export JSON.

Find representative colors in a picture

The extractor samples an image and groups similar RGB values into a palette. Each row shows HEX, RGB, rounded HSL and a percentage. Use it as a starting point for a design palette, not a colorimeter, brand-color certification or accessibility check. Supported input types are PNG, JPEG, WebP, GIF and BMP when your browser can decode them.

What the percentages mean

The extraction sample preserves aspect ratio and fits within 150 by 150 pixels without enlarging small images. Pixels with alpha below 128 are ignored; partially transparent pixels at or above 128 are counted equally using their RGB values, not composited onto a background. Percentages describe the included sampled pixels, not exact areas in the full-resolution original. Downsampling and interpolation can introduce colors along edges.

The algorithm splits color groups by RGB range and population until reaching the requested maximum or exhausting separable colors. It averages each group and merges identical representative RGB values. All included sample pixels contribute to a group, including when you request 3, 5 or another non-power-of-two count. A single-color image can return one color even if you request more. Percentages rounded to one decimal may not sum to exactly 100.0.

Input and output limits

One file at a time, up to 20 MiB and 40 million decoded pixels. Decoding has a 15-second timeout, but the decoded size is checked after loading and cannot prevent every memory spike. Animated inputs are analyzed as a still image. A fully transparent sample gives an explicit empty-result message. Loading another image or editing the requested count clears the previous palette.

Copy and export

Clicking a row copies one HEX value. Copy CSS copies a comma-separated HEX list, not a full stylesheet or CSS custom properties. JSON includes HEX, RGB components, an HSL array and the rounded percentage string. Clipboard permission may prevent automatic copying. The processing code does not upload your image; loading the site still involves network requests. Keep color-critical work in a color-managed workflow and evaluate text contrast separately. Use Image Cropper if only one region should influence the palette.

Frequently Asked Questions

Are the percentages exact original-image coverage?
No. They describe included pixels in a reduced sample.
Why are there fewer colors than requested?
The number is a maximum. Uniform images or merged representatives can produce fewer colors.
How is transparency handled?
Alpha below 128 is ignored; other pixels count equally without background compositing.