Skip to content
CrayonPix

Color Palette from Image

Turn a photo into a color palette. The tool finds the main colors of your image, shows how much of the picture each one covers, and gives you their codes ready to paste.

Loading the tool…

Your images are processed on your device and never uploaded.

How to use Color Palette from Image

  1. 1

    Choose, drop or paste a photo, artwork or screenshot.

  2. 2

    Pick how many colors you want (3 to 12) and the order they are listed in.

  3. 3

    Copy the codes as a HEX list, CSS variables or JSON, or download the palette as a PNG.

Extract the main colors of a photo

A good palette usually starts from a photo: a sunset for a website theme, a product shot for brand colors, a painting for a room’s decor. This tool reads your image and gives you its dominant colors as a row of swatches, each with its HEX, RGB and HSL code and the share of the image it represents.

The palette is ready as soon as the image opens, and it updates instantly when you change a setting. A bar under the image shows the colors in proportion to how much space they take, so you can see at a glance which tones dominate.

How the palette is computed

The tool reads up to 20,000 evenly spaced pixels from the image (mostly transparent ones are skipped) and runs the median cut algorithm on them:

  1. All sampled colors start in one group.
  2. The group with the widest spread on red, green or blue is sorted on that channel and cut in half at the median.
  3. This repeats until there are as many groups as colors you asked for.
  4. Each group’s average becomes one palette color.

Because each cut happens at the median, the palette follows how much of the image each color covers: a photo that is mostly blue sky gets several shades of blue. A flat graphic with only a few colors may return fewer swatches than requested, since identical colors can’t be split further.

Settings

Setting Options
Number of colors 3 to 12 (6 by default)
Order Most common first, Dark to light, or By hue (rainbow order, with grays at the end)

Copy, export and save

  • Click a swatch to copy its HEX code.
  • Copy HEX list — #1d3557, #457b9d, … for design apps and color tools.
  • Copy CSS variables — a :root { --color-1: …; } block to paste into a stylesheet.
  • Copy JSON — an array of HEX strings for code or design tokens.
  • Download palette (PNG) — an image with one 240-pixel-wide color bar per swatch and its HEX code underneath, handy for mood boards and sharing.

Tips

  • Want one exact color rather than an average? Use the Image Color Picker and click the spot.
  • Crop first if you want the palette of one object: the whole image is analyzed, so a large background will take several swatches.
  • Turn the palette into art: Image to Pixel Art redraws a photo using a limited palette built the same way.
  • Recolor the photo with one of the palette colors in Change Image Color.

Private by design

The image is decoded and analyzed by your browser — JPG, PNG, WebP, AVIF, GIF, BMP, SVG and iPhone HEIC photos all work — and nothing is uploaded. The page keeps working offline once it has loaded, and the palette PNG contains only the color bars, never any part of your photo or its metadata.

Frequently asked questions

How do I get a color palette from a picture?

Open the picture on this page. A palette of 6 colors appears right away under the image; move the "Number of colors" slider to get anywhere from 3 to 12. Click a swatch to copy its HEX code.

How are the colors chosen?

The tool samples up to 20,000 pixels from the image and groups them with the median cut algorithm, which keeps splitting the set of colors along its widest channel until it has the number of groups you asked for. Each palette color is the average of one group.

What does the percentage next to each color mean?

It is the share of the sampled pixels that are closer to that color than to any other color in the palette — a rough measure of how much of the image it covers.

Can I use the palette in CSS or a design app?

Yes. "Copy CSS variables" gives you a :root block with --color-1, --color-2 and so on. "Copy JSON" gives an array of HEX strings, and "Copy HEX list" a comma-separated list most design apps accept.

Why does the palette change when I change the number of colors?

Median cut splits the colors step by step, so asking for more colors divides the existing groups into finer ones. The overall feel stays the same, but individual swatches can shift.

Is my image uploaded?

No. The colors are computed by your browser on your device, and the image never leaves it.