How to Extract a Colour Palette
Extract a colour palette from any photo in five steps: upload, pick 3–12 swatches, read the percentages, and copy CSS or JSON — free, in your browser.
Extract a colour palette from any photo: 3 to 12 swatches, ranked by coverage, with HEX, RGB, HSL, CSS export, JSON, and a palette card download.
CompressMyPic Editorial Team · Published Nov 17, 2026 · 11 min read

Every good design starts with a color palette, and every good palette starts somewhere real: a photograph, a brand image, or a scene that already feels right.
A color palette extractor finds the dominant colors in that image for you. It scans the pixels, groups them into the colors that matter, and hands you a ranked palette in seconds.
This guide explains how the CompressMyPic image color palette extractor works, what each feature does, and how to turn a photo into a palette you can actually use.
A color palette extractor analyzes an image and returns its most important colors as a set of swatches. Each swatch shows the color, its HEX, RGB, and HSL values, and the share of the image it covers.
You upload a photo, choose how many colors you want, and the tool builds the palette. The result is a ready-made color scheme that already works together, because the colors came from the same picture.
The tool accepts common image formats up to 20 MB, which covers phone photos, product shots, screenshots, and brand imagery. Everything runs locally in your browser, so client mood boards and unreleased concepts stay private.
Designers use it to start a project, developers use it to theme a website from a hero image, and content creators use it to keep thumbnails and graphics consistent.
The extractor builds its palette with an algorithm called Median-Cut quantization. It is a standard technique for reducing thousands of colors down to a small representative set.
The algorithm starts with all the pixels of the image in one box. It finds the color channel with the widest range, splits the box in half at the median, and repeats the split until it has as many boxes as you asked for.
Each box then contributes one color: the average of the pixels inside it. The result is a set of colors that represents the whole image fairly, with large areas getting their own swatch and small details sharing one.
Median-Cut is fast and predictable, which is why it is used in tools everywhere. It does not need a server or a machine learning model, and it runs instantly in your browser.
A slider controls how many swatches the palette contains, from 3 to 12, with 6 as the default. The count changes the character of the palette, not just its length.
Three colors give you a minimal scheme: a dominant, a secondary, and an accent. That is enough for a clean website, a simple poster, or a logo treatment.
Six colors is the balanced default. It captures the main tones of most photos without splitting similar shades into near-duplicates that are hard to tell apart.
Twelve colors is the maximum, and it suits complex photos with many distinct areas. The trade-off is that similar shades start appearing twice, so a 12-color palette often needs a little pruning by hand.
Every swatch carries a percentage badge showing how much of the image that color covers. A color at 42 percent dominates the photo, while one at 3 percent is a small accent.
The percentages tell you the hierarchy of the palette. The largest color is usually the background or the main subject, and the smallest ones are the details that give the image its character.
Use the percentages when you build a design. A common rule is to give the dominant color the most space, the secondary color a supporting role, and the smallest colors only to accents and highlights.
If two swatches have nearly the same percentage and nearly the same color, they are probably one color split by the algorithm. Keep one, drop the other, and the palette gets cleaner.
Below the swatches, the tool shows a proportional color strip: a single bar divided into segments sized by each color share of the image. It is the palette as a picture.
The strip makes the balance visible at a glance. A photo with one huge segment and several slivers is a photo with a strong dominant color and small accents, while an even strip means a busy, colorful image.
Designers use the strip to judge whether a palette will work. A palette whose strip is mostly one color will produce calm designs, while a palette with many equal segments will produce busy ones.
The strip also helps you spot the accent. The smallest segment is often the color that makes the photo memorable, and it is usually the right choice for buttons and highlights.
The Copy CSS button copies all the swatches as CSS custom properties in one action. You get variables such as --color-1 through --color-6, each holding a HEX value, ready to paste into a stylesheet.
This is faster and safer than copying codes one at a time. The export keeps every color in order, with no transcription errors and no missing swatches.
Change the swatch count and the export updates. You can switch from 6 colors to 4 without re-uploading the image, and the copied CSS reflects the new set immediately.
For a single exact pixel instead of a whole palette, use the image color picker. The picker reads one pixel you choose, while the extractor ranks the colors of the whole image.
The Copy JSON button exports the palette as structured data, with each color listed alongside its HEX, RGB, and HSL values and its percentage share of the image.
JSON is the right format when the palette feeds into code rather than a stylesheet. A design token pipeline, a theme generator, or a configuration file can all consume the JSON directly.
The export includes the same data the screen shows, in a form a script can parse. That makes the palette reusable across projects without anyone retyping values.
Keep the JSON file with the project. When the design system needs the palette again months later, the file is the single source of truth, and nobody has to re-extract it from the photo.
The Download Palette PNG button generates a palette card image: the original photo with the swatch strip and colors laid out beneath it. It is a visual summary of the extraction.
The card is useful for sharing a palette with a client or a team. A picture of the palette communicates faster than a list of HEX codes, especially to people who do not read code.
Use the card in mood boards, brand documents, and presentations. It shows where the colors came from, which builds trust in the palette, because the client can see the source photo.
The card is generated locally in your browser, like everything else in the tool. No image data leaves your device to produce it.
The extractor and the eyedropper answer different questions. The extractor asks which colors define the whole image, while the eyedropper asks what color this one pixel is.
Use the extractor when you want ideas. It shows you the palette a photo already contains, ranked by coverage, and it often surfaces colors you would not have picked by eye.
Use the eyedropper when you want precision. The exact blue of a logo, the exact shade of a button, or the exact tone of a wall all need a single-pixel reading.
Many designers use both in one workflow. They extract a palette for the overall scheme, then use the picker to grab one precise accent the extractor ranked too low to include.
PNG files can carry transparency, and the extractor handles it by ignoring fully transparent pixels when it builds the palette. A logo on a transparent background contributes only its visible colors.
This matters because a transparent area has no color of its own. Including it would add a false swatch, usually white or black, that does not represent anything in the design.
Semi-transparent pixels are a gray area. A pixel that is half transparent blends its color with whatever sits behind it, so the extractor reads the blended result rather than the pure color.
For logos, the extractor works best on a solid background. If the palette looks wrong, place the logo on a white or brand-colored background first and extract from that version.
A small bright accent can vanish from a palette, even when it is the most memorable part of the photo. The reason is coverage: the extractor ranks colors by how much of the image they fill.
A neon sign that covers 1 percent of a photo is a small share, so the algorithm may fold it into a neighboring color rather than giving it a swatch of its own.
Raising the swatch count helps. At 12 colors, small accents get their own boxes more often, because the algorithm splits the image into finer groups.
If the accent still does not appear, grab it with the eyedropper instead. The image color picker reads the exact pixel, and you can add that color to the extracted palette by hand.
A 12-color palette sometimes shows two swatches that look almost identical. This happens when a large area of the image has a gentle gradient, such as a sky that shifts from light blue to slightly darker blue.
The algorithm splits that gradient into two boxes, and each box contributes its own average. The two averages are close, but they are genuinely different parts of the image.
When you see near-duplicates, keep the one that matches your design better and drop the other. A palette with one blue is cleaner than a palette with two blues nobody can distinguish.
Alternatively, lower the swatch count. At 6 colors, the gradient usually falls into a single box, and the duplicate disappears on its own.
Palette extraction involves images that are often sensitive: client brand concepts, unreleased mood boards, and personal photos. Uploading those to a server is a risk you do not need to take.
The extractor reads the image locally. The browser samples the pixels, runs the quantization, and builds the palette without sending a single byte anywhere.
That also means the tool works offline once the page has loaded. You can extract palettes on a plane, in a meeting room, or in a secure office without any connection.
For teams handling confidential brand work, local processing is the deciding feature. No copy of the image exists outside your own machine at any point in the workflow.
The percentage badges are more than labels; they are a recipe for the design. A color at 45 percent of the photo should take roughly 45 percent of the layout, because that proportion is what made the photo feel balanced.
Start a layout by assigning the largest color to the background. It is the color the eye is most used to seeing in large areas, so a page built on it feels calm and familiar from the first glance.
Give the second-largest color to the main content areas: cards, panels, and sections. It supports the background without competing with it, and the two together create the structure of the page.
Reserve the smallest colors for the elements that must be noticed: buttons, links, and highlights. A 3 percent color used at 3 percent of the layout draws the eye exactly where the photo drew it.
When the percentages do not fit the layout, adjust them deliberately. A dashboard may need more of a secondary color than the photo had, and that is fine, as long as the change is a decision rather than an accident.
The proportional strip is the fastest way to check the weighting. Compare the strip with your layout side by side, and the mismatch, if there is one, will be obvious.
Open the image color palette extractor and drop your image into the upload area, or paste a screenshot straight from the clipboard. Files up to 20 MB are accepted.
Move the slider to choose between 3 and 12 swatches, starting from the default of 6. The palette rebuilds instantly, with percentages and the proportional strip updating together.
Copy the palette as CSS custom properties or JSON, or download the palette card as a PNG to share with your team.
For the step-by-step version, read How to Extract a Colour Palette from an Image, and for design workflow tips, see Colour Palettes from Photos: Design Workflow Tips.
Extract a colour palette from any photo in five steps: upload, pick 3–12 swatches, read the percentages, and copy CSS or JSON — free, in your browser.
Turn photos into design palettes that actually work: the 60-30-10 rule, dominant vs accent, contrast, brand use, and the mistakes that make palettes muddy.
Base64 strings and image files carry the same picture in different ways. Compare size, speed, caching, and editing, and learn when each one wins.
Convert a Base64 string to an image in four steps: paste, preview, pick Original, PNG, JPG, or WebP, and download. Handles URL-safe strings and line breaks.