Practical guide
Extract a Color Palette from an Image
By MultiZest · Updated
How to use this tool
- Choose one supported image up to 20 MB and 40 megapixels, or load the example.
- Choose the requested number of colors and extract the palette.
- Inspect the swatches, copy HEX values and download JSON or CSS.
Worked example
A simple image with only two opaque colors may return two swatches even if you request six. The tool does not invent extra distinct colors to fill the requested count.
Representative colors, not every pixel
The image is sampled at a maximum of 192 pixels on its longest side. Weighted color clustering groups similar RGB samples into a small palette, ordered by approximate sample share. Percentages may not add to exactly 100 after rounding.
Mostly transparent pixels are ignored. Colors on thin edges, small details or partially transparent overlays can differ from a full-resolution analysis. Use the image color picker for a specific original pixel.
Use palettes as a design starting point
Copy a swatch by clicking it. JSON includes RGB values and approximate shares; CSS exports variables named --palette-1 and onward. Neither export changes your website automatically.
A color palette does not establish accessible combinations. Check text/background pairs with the contrast checker before using them in an interface.
Turn a photograph into a starting palette
A café photograph might contain warm wood, cream walls, dark lettering and a green plant. The palette extractor can help you notice those relationships when planning a menu or website. Treat the swatches as suggestions from the image rather than a finished brand system; colors need clear roles before they become useful design choices.
Choose one background color, one text color and a small number of accents. A frequent color in the photo is not automatically suitable for body text or buttons. You may need a darker or lighter variation to create contrast while retaining the feeling of the original photograph.
Separate representative colors from exact measurements
The palette summarizes sampled image colors, so a small logo or important detail may not appear among the dominant swatches. Crop the image to the region of interest if that detail should guide the palette. Use the pixel color picker when you need the value from one particular flat area.
Copy a swatch into your actual design and test it against its neighbors. Shadows, photo compression and antialiasing can influence the values. Check foreground and background pairs with the contrast checker before using them for essential text, and label exported CSS variables according to their purpose rather than only their hue.
Questions and troubleshooting
Why do I receive fewer colors than requested?
A flat or simple image may contain fewer distinct sample clusters. Transparent images can have few or no sufficiently opaque pixels.
Are these guaranteed to be accessible colors?
No. Contrast depends on the foreground/background pair and context. Use a contrast check after choosing a palette.
Can the extractor recover the official colors of a brand?
A photo or screenshot may contain shadows, compression and altered colors. Use the brand’s original design files or published specifications when exact brand values are required.
Continue with a related tool
Check WCAG AA and AAA color contrast, preview text and compare normal text, large text and interface thresholds.
Image Color Picker →Click or tap an image pixel to inspect its HEX and RGB values in your browser.
CSS Gradient Generator →Create linear, radial, and conic CSS background gradients with live preview and code export.
Sources and further reading
Found an error or an unclear instruction? Report it. Read our editorial policy and privacy policy.