ImgVX AI

How to Extract a Color Palette From an Image (Free)

To extract a color palette from an image, open the free Colour Palette Extractor, drop in the image and choose how many colors you want, from 3 to 12. The main colors appear at once as HEX, RGB and HSL codes, each with its share of the image, plus a CSS block to copy. The image is never uploaded and there is no sign-up. Below are real palettes from 18 runs, how many colors to take, why the subject’s color is often missing, and how to check the colors work together as text and background.

A photo of a golden retriever puppy on a wooden deck in front of a flower garden, next to two rows of color swatches taken from it. The six-color row is mostly beige and olive greens from the deck and garden; the twelve-color row adds the orange-brown tones of the puppy's fur.
Real output of the Colour Palette Extractor: six colors, then twelve, from the same photo.

The short answer

  • Tool: Colour Palette Extractor. Free, no account, works in your browser.
  • What you get: 3 to 12 colors as HEX, RGB and HSL, the percentage of pixels in each, and CSS variables (--color-1, --color-2…).
  • Speed: 107 to 118 milliseconds per image in our test.
  • How many: six for a photo, three to six for a logo or screenshot. Ask for twelve when the subject is small.
  • Not the right tool for one exact pixel (use the Colour Picker) or for official brand colors you can get from a brand guide.

How do you extract a color palette from an image?

  1. Open the Colour Palette Extractor in a current browser on a computer or a phone.
  2. Set the Colours slider to the number you want, from 3 to 12. The default is 6.
  3. Drop in the image, or click to choose it. A photo, a screenshot, a logo or a scan of a painting all work. The palette appears straight away.
  4. Copy what you need. Each swatch lists its HEX code, its rgb() and hsl() values and the percentage of pixels in that shade. Under the swatches, a :root { } block holds every color as a CSS variable, ready to paste into a stylesheet.

To try another count, move the slider and drop the same image again. Nothing is sent anywhere: the image is read in your browser, so a client’s unreleased design or a private photo never leaves your device.

How does a color palette extractor choose the colors?

Even a small photo holds a great many slightly different colors, so every extractor has to group them. Many tools, such as Pincel’s, use k-means clustering, which starts from random guesses; Pincel’s own page says its results can differ slightly between runs for that reason. The ImgVX tool uses a simpler, fixed method, read from its source code:

  1. It shrinks the image to 180 pixels on its longest side. That is plenty to find the main colors and keeps each run near a tenth of a second.
  2. It skips see-through pixels. Any pixel more than half transparent is left out, so the empty area around a logo does not count.
  3. It sorts every other pixel into one of 4,096 boxes, 16 steps each of red, green and blue, and counts the pixels in each box.
  4. It lists the fullest boxes first, each as the average color of the pixels inside it.
  5. It drops near-duplicates. A color whose red, green and blue together differ by less than 60 from one already listed is skipped, so you get distinct colors rather than six beiges.

Two things follow. The same image always gives the same palette, so a palette you share can be reproduced by anyone. And the order is by area, not by importance: the colors that cover the most pixels come first, whatever they belong to. That second point explains most surprising palettes.

How many colors should you extract from an image?

Two photos, each with three rows of swatches for 3, 6 and 12 colors. For a street with a yellow tram, the 3 and 6 color rows are browns, beiges and a pale sky blue; only the 12 color row ends with the tram's orange-yellow. For the puppy photo, the 3 and 6 color rows are beige and olive green; the 12 color row adds the fur's orange-browns.
3, 6 and 12 colors from the same two photos. The tram and the puppy only show up at 12.

We ran the live tool on 19 November 2026 in Microsoft Edge 157 on Windows, on the photos from our own home page. The table shows what each count gave.

Image3 colors6 colors12 colors
Golden puppy on a deck, garden behindBeige deck, two olive greensAdds a dark green, a grey-beige and a light oliveAdds the fur: #b88867, #986948, #d6a27b and a dark brown
Street with a yellow tramThree browns and beiges from the buildingsAdds a pale sky blue (#c9e5fa) and a warm creamLast of the twelve: the tram’s orange-yellow, #d98704, at 0.5 percent of pixels
Hummingbird among leavesTwo soft greens and a mauve-greySix muted greens and mauvesOnly 8 colors: the photo had no more distinct ones

The lesson is the same in both main photos: six colors described the background, and the subject only appeared at twelve. The puppy covers less of the frame than the deck and the garden, and the tram is a small object in a street of brown walls. Both colors were there all along; they were simply further down a list sorted by area.

A practical way to work:

Do photos, screenshots and logos give different palettes?

Left: a screenshot of the dark ImgVX AI home page and its six colors, from near-black and white to dark purples and a bright violet. Right: a black-and-white photo of a lighthouse on a cliff and the seven greys the tool returned when twelve colors were asked for.
A web page screenshot gives its exact CSS colors. A black-and-white photo runs out of distinct greys at seven.

Yes, and the difference is useful to know before you trust a HEX code.

Image typeWhat we gotAre the codes exact?
Web page screenshot (imgvx.com, 1280 × 800)Near-black #0b0912 at 36.9 percent, white, three dark purples and the violet button color #7c3aedYes for flat areas: #0b0912 and #7c3aed are exactly the background and accent values in the site’s own stylesheet
Photo (puppy, tram, hummingbird)Soft, slightly muted tonesNo. Each code is the average of many similar pixels, so it may not match any single pixel
Black-and-white photo (lighthouse)Greys only, from #181818 to #f2f2f2; 7 colors when 12 were asked forThey are true greys (red, green and blue equal)
Logo on a transparent backgroundOne color, #ffffff, 100 percentYes; the transparent area is ignored

For a website or an app, a screenshot works well: take it at 100 percent zoom so text edges are sharp, and the large flat areas come back with their real codes. For a logo, use the original PNG or SVG rather than a photo of a sign or a printout, because light and the camera shift every color. Photos are best for mood: the colors of a room, a sunset or an outfit you want a design to feel like, rather than codes that must match something exactly. When you need the precise value of one spot, click it with the Colour Picker instead.

What do the percentages next to each color mean?

Each percentage is the share of the counted pixels that fell into that one shade’s box. Because similar shades land in neighbouring boxes and near-duplicates are left off the list, the numbers rarely add up to 100:

So read the percentages as a ranking, not a recipe. A color at 4 percent in a photo can still be the one the eye sees most, while a 0.5 percent color, like the tram, can be the one the picture is about.

Will the extracted colors work as text and background?

Not automatically. A palette taken from a photo is often a set of similar, mid-toned colors that look good side by side but are hard to read on top of each other. The Web Content Accessibility Guidelines (WCAG 2.2, success criterion 1.4.3) ask for a contrast ratio of at least 4.5 to 1 for normal text and 3 to 1 for large text, meaning 18 point, or 14 point bold; 7 to 1 meets the stricter AAA level. We checked pairs from our palettes with the WCAG formula:

Text color on backgroundFromContrast ratioResult
#0b0912 on #fefeffWeb page screenshot19.62 : 1Passes AAA
#ffffff on #7c3aedWeb page screenshot5.70 : 1Passes AA for normal text
#7c3aed on #0b0912Web page screenshot3.47 : 1Large text only
#262816 on #c9b5a8Puppy photo7.63 : 1Passes AAA
#474827 on #c9b5a8Puppy photo4.79 : 1Passes AA
#a99689 on #c9b5a8Puppy photo1.44 : 1Fails: do not put text on it
#443c38 on #ecd4bbTram photo7.54 : 1Passes AAA
#685a54 on #b7a898Tram photo2.85 : 1Fails
#5b6455 on #a79aa5Hummingbird photo2.30 : 1Fails
#474b43 on #bab3bbHummingbird photo4.35 : 1Large text only

The pattern is reliable: pair the darkest color of a palette with the lightest, and keep the mid-tones for shapes, borders and backgrounds without text. If the photo has no dark enough or light enough color, add a near-black or near-white neutral yourself; most good palettes have one. To see how the palette looks to people with color blindness, run a mock-up through the Colour Blindness Simulator, and read the guide to color-blind friendly images for which pairs to avoid.

How do you use the palette in CSS, Figma or Canva?

  1. CSS: copy the :root { --color-1: … } block under the swatches into your stylesheet, then rename the variables by their job, for example --brand, --accent, --text and --surface, so they still make sense later.
  2. Figma, Canva and most design apps accept a HEX code in their color field. Paste each code and save it in the app’s own color styles or brand kit.
  3. Print: HEX and RGB are screen colors. A printer turns them into ink, and the result can look duller. For print work, match the colors to a printed swatch guide or ask the printer for a proof.
  4. Painting and crafts: the same palette can guide paint mixing or thread choice. The Paint by Numbers tool turns a photo into a numbered outline with a color key, and Image to Pixel Art reduces it to a small retro palette.

If you want to change a color in the image itself rather than copy it, that is a different job: see how to change the color of an object in a photo, which uses the Colour Replacer.

Which color palette extractor should you use?

We read each tool’s own page on 19 November 2026. The table lists what those pages state.

ToolWhere the image goesColorsFormats you getShows each color’s share
ImgVX AI Colour Palette ExtractorStays in your browser3 to 12 (default 6)HEX, RGB, HSL, CSS variablesYes, as a percentage; same result every run
Cloudinary Image Palette ExtractorUploaded4, 6, 8, 12 or 16HEX, RGB, CSS variables, Tailwind config, JSON, ZIPYes, as bar widths; JPG, PNG or WebP up to 20 MB
Pincel palette extractorStays in your browser4 to 10HEX, RGB, HSL, PNG swatch, CSS variables, TailwindNot stated; results can vary slightly between runs
Image Online palette from imageStays in your browser2 to 12 (default 5)HEX, RGB, HSL, CSS block, palette card imageNo
Instant GradientStays in your browser2 to 8HEX, or send to its gradient makerNot stated

If you need a Tailwind config or JSON file, Cloudinary and Pincel export those directly; with ImgVX you copy the CSS block and convert it. If you need a palette card image to post, Image Online makes one. ImgVX is the choice when you want to know how much of the image each color covers, need the same result every time, or prefer that the image never leaves your device. For other inspection tools in the same family, the free AI image editing guide lists everything that runs on your device.

Troubleshooting

What you seeCauseFix
The subject’s color is missingThe background covers more pixelsSet 12 colors, or crop to the subject first with the Image Cropper
Fewer colors than you asked forThe image has no more colors that are clearly differentNormal for black-and-white, muted or one-color images; nothing to fix
The colors look dull compared with the photoEach color is an average of similar pixels; bright highlights are smallPick the bright spot with the Colour Picker, or brighten the photo first in Image Adjustments
A logo color is slightly offJPEG compression or a photo of the logo shifts colorsUse the original PNG or SVG, or the brand’s published codes
The background of a logo is not in the palettePixels more than half transparent are skippedExpected; add a background color yourself if you need one
A near-white shows saturation 100 percent in HSLAt almost full lightness, a tiny tint gives a large saturation number (#fefeff reads hsl(240, 100%, 100%))Ignore it; use the HEX code, which is exact
Text in the palette colors is hard to readMid-tones paired with mid-tonesPair the darkest with the lightest and check 4.5 : 1 (see the table above)
You want to see the full range of tones, not a paletteA palette lists colors, not their spreadUse the Histogram Viewer

Questions

How do I get a color palette from an image?

Open the free Colour Palette Extractor, drop in the image and set the Colours slider (3 to 12, six by default). The palette appears straight away as HEX, RGB and HSL codes, with each color's share of the image and a CSS block you can copy. The image stays in your browser and there is no sign-up.

How many colors should I extract from an image?

Take six for a photo and three to six for a logo, an icon or a web page screenshot. In our tests, six colors from a photo were mostly the background; the colors of the subject itself, such as a golden puppy or a yellow tram, only appeared at twelve. Extract twelve, then keep the five or six you will actually use.

Why does the palette miss the main color of my subject?

The palette ranks colors by how many pixels share them, and a background usually covers more of the picture than the subject. Raise the color count, or crop the image to the subject with the Image Cropper first and extract again. For one exact color, click it with the Colour Picker.

Can I get the exact HEX code of a logo or website color?

Yes, for flat colors. On a screenshot of the ImgVX AI home page, the extractor returned #0b0912 and #7c3aed, exactly the background and accent values in the site's own CSS. Photos give averages instead, so for brand work use a PNG or SVG of the logo, not a photo of it.

Why don't the percentages add up to 100?

Each percentage is the share of pixels in that one shade. Similar shades are grouped separately and near-duplicates are left out of the list, so the listed colors usually cover only part of the picture: 16.0 percent for six colors from the puppy photo. On flat images with large areas of one color, such as a dark web page, the listed colors cover much more. More help: ImgVX AI help docs.

Why did I get fewer colors than I asked for?

The tool skips any color that is too close to one it has already listed, so an image without enough different colors returns fewer. A black-and-white photo gave seven greys when twelve were asked for, a hummingbird photo in soft greens gave eight, and a one-color logo gave one. Browse: all free image tools.

Is it safe to extract colors from a private image?

Yes. The ImgVX AI Colour Palette Extractor reads the image in your browser and never uploads it, so a client mock-up or an unreleased design stays on your device. It is free, with no account, watermark or daily limit.

Do transparent pixels count in the palette?

No. Pixels that are more than half transparent are skipped, so a logo on a transparent background gives the colors of the logo only. Our white ImgVX logo on a transparent PNG came back as a single color, #ffffff, covering 100 percent of the counted pixels.