Boneyard Tools

Extract a Color Palette From an Image

Pull the dominant colors out of any image and turn them into a usable palette. The tool scales the photo down to a 200 pixel sample, groups its colors with median-cut quantization, and ranks each swatch by the share of pixels it represents. Copy any single hex code, or export the whole set as CSS custom properties. Everything runs in your browser, so the image never leaves your device.

How to extract a color palette

  1. Drop an image onto the drop zone, or click to browse for a PNG, JPEG, WebP, GIF or BMP.
  2. Pick how many colors you want using the 4, 6, 8 or 12 buttons.
  3. Read the proportional bar and swatches, each labelled with its hex, RGB and percentage share.
  4. Click any swatch to copy its hex code, or use Copy CSS or Copy hex list for the full palette.
  5. Choose New image to start over with a different photo.

Examples

Six-color palette from a landscape photo

A beach photo, palette size set to 6
Six hex swatches ordered by share, for example a dominant sky blue at 41.2% down to a sand tone at 6.5%

Simple logo with only a few colors

A two-color logo, palette size set to 8
Just two swatches returned, because the image has fewer distinct colors than requested

Export the palette to CSS

Any photo, then Copy CSS
:root { --color-1: #1b3a5f; --color-2: #c9a24b; ... } ready to paste into a stylesheet

Frequently asked questions

Is my image uploaded anywhere?

No. The image is decoded, scaled down, and analyzed entirely in your browser using a canvas. No bytes are sent to a server, so private screenshots, artwork, and photos stay on your device.

How are the colors chosen?

The tool uses median-cut quantization. It samples the pixels, repeatedly splits the color box with the widest channel spread at the midpoint of that channel, then averages each final box into one representative color. Swatches are ranked by how many sampled pixels fall into each group.

Why do I sometimes get fewer colors than I asked for?

The tool only splits groups that still contain a spread of colors. If an image has just a handful of distinct colors, such as a flat logo or a screenshot with solid fills, it returns those real colors instead of inventing extra near-duplicates.

Does it downscale my photo first?

Yes. The image is scaled so its longest edge is about 200 pixels before sampling, which keeps the analysis fast on large photos. The palette reflects the whole image because scaling blends nearby pixels rather than dropping regions.

Are transparent areas counted?

No. Pixels below an alpha threshold are dropped before analysis, so a transparent PNG background does not pollute the palette with a phantom color. Only reasonably opaque pixels contribute to the swatches.

Will the swatch match a pixel exactly?

Not quite. Each swatch is the average of a cluster of similar pixels, so it represents a region of the image rather than one exact pixel. For an exact single-pixel value, use the image color picker instead.

What does the percentage on each swatch mean?

It is the share of sampled pixels assigned to that color group. The colors are sorted from the largest share to the smallest, and the proportional bar at the top shows the same weighting as a single stacked strip.

What can I export?

Click a swatch to copy its hex code on its own. Copy hex list gives a comma-separated list of every hex in the palette, and Copy CSS wraps the palette in a :root block with numbered custom properties ready to drop into a stylesheet.

Will the same image always give the same palette?

Yes. The algorithm is fully deterministic with no random seeding, so re-running it on the same image at the same color count produces an identical palette every time.

Learn more

  • How color palette extraction works

    A plain-language look at median-cut quantization, why palettes are ranked by pixel share, and how to turn extracted colors into a design system.

Related tools