Image Color Palette Generator
Build an approximate 1–32 colour palette from an image — export CSS variables, in your browser.
Image Color Palette Generator is a browser-based image tool on ImgToolsBase. Build an approximate 1–32 colour palette from an image — export CSS variables, in your browser. To use it, upload or drop your image and view the result directly in your browser — no signup and nothing to install.
How this tool works
What it does
Groups similar pixels from a whole-image canvas sample and returns the most common buckets as a palette with percentage shares.
Palette size
Set any count from 1 to 32; fewer may be returned if the image has fewer distinct buckets.
Readable labels
Swatch text is light or dark based on luminance, with an accessible colour name.
Privacy
Everything runs in your browser on a canvas — your image is never uploaded.
Image Color Palette Generator in your browser
Image Color Palette Generator builds an approximate colour palette from your image by grouping similar pixels from a whole-image canvas sample and returning the most common buckets, each with the share of analysed pixels it covers. Choose how many colours you want, from one up to thirty-two.
An adjustable grouping level controls how aggressively close shades are merged, and you can ignore transparent pixels, alpha-weight them, or include them all. Each swatch is labelled and uses automatic light-or-dark text so the HEX stays readable on any colour.
It is a fast quantised palette, not a perceptual clustering algorithm such as k-means, and the colours come from the browser-rendered sRGB canvas rather than the raw file bytes. Export the palette as TXT, JSON, CSS variables or CSV, or copy all colours at once.
How to use Image Color Palette Generator
- Add an image to Image Color Palette Generator using the drop zone, the Enter key, or drag and drop.
- Choose the palette size (1 to 32) and the grouping level, and decide how transparent pixels are handled.
- Pick an export format (TXT, JSON, CSS variables, or CSV) and click Process to generate the palette.
- Copy individual swatches, use Copy all colours, or download the palette file.
Why use Image Color Palette Generator
Generate anywhere from 1 to 32 colours instead of a fixed count.
Buckets come from a full-coverage sample with the aspect ratio kept, not a cropped square.
Each swatch auto-picks light or dark text and carries an accessible colour label.
Download TXT, JSON, CSS variables or CSV, or copy every colour at once.
Common uses for Image Color Palette Generator
Pull a starting palette from a moodboard or product photo.
Export :root custom properties straight into a stylesheet.
Capture the recurring colours of an illustration or UI screenshot.
Summarise an image's colours with percentage shares.
Frequently asked questions
How does Image Color Palette Generator choose the colours?
It groups similar browser-rendered pixels from a whole-image sample into buckets and returns the largest buckets as the palette, with each colour's share of analysed pixels. It is a fast quantised approximation, not a perceptual clustering method like k-means.
Can I set how many colours Image Color Palette Generator returns?
Yes. The palette-size control accepts any whole number from 1 to 32. If the image has fewer distinct buckets than requested, the result details note how many colours were actually found.
Can Image Color Palette Generator export CSS variables?
Yes. Choose the CSS export to download a :root block of --color-1, --color-2 and so on as custom properties, or copy all the HEX values at once. TXT, JSON and CSV exports are also available.
Why is the text on each swatch sometimes dark and sometimes light?
Each swatch picks black or white text automatically from the colour's luminance, so the HEX label stays readable on both light and dark colours. Swatches also carry an accessible colour label.
Are the palette colours read from the original file?
They are read from the browser-rendered sRGB canvas, not the raw file bytes, so embedded profiles, CMYK source data or HDR may shift them. No image is uploaded to build the palette.
Related colour tools
Tools that pair well with Image Color Palette Generator.