Accessible Image Extractor
Upload a mockup or screenshot. Extract the 4 dominant colors, automatically assign them web UI roles, and verify their WCAG legibility in real time.
Drag & drop your image here
Supports PNG, JPG, WebP, or SVG. Or click to browse.
How it works
1. Upload an image to analyze colors.
2. Our canvas tool samples colors and clusters them to get the 4 most prominent ones.
3. The colors are sorted based on luminance to find the best background/text combo.
4. Preview mockups and copy config codes instantly!
Designing for Accessibility
When you extract colors from screenshots or graphic assets, they are often not immediately accessible for text and backgrounds. Contrast ratios must meet WCAG guidelines so that the content is legible to people with different vision capabilities.
This tool does more than list hex codes: it automatically evaluates which color serves best as the page base and which should be text, ensuring the core of your design has the best possible contrast out of the box.
If a combination shows a Fail grade, click Edit in Generator to open the palette and randomize harmonious, accessible adjustments while locking the accent colors you love!
How the colours are extracted, and where your image goes
What it does
Reads an image in your browser, shrinks it to 100×100 pixels on a canvas, groups similar pixels into clusters, keeps the four largest, and assigns them to UI roles — background, accent, secondary and text.
When you would use it
You have a photograph, a screenshot or a client's logo and need a starting palette that is actually derived from it rather than guessed. It is also the fastest way to answer “what are the real colours in this image?” before choosing a brand palette around them.
How to use it
- Drop an image onto the panel or click to choose a file. Any format your browser can decode works — JPEG, PNG, WebP, GIF, SVG.
- Extraction runs immediately on load; there is no submit button.
- Read the four role swatches, then the contrast cards below them to see which text/background pairs are usable.
- Copy the Tailwind config, or open the palette in the generator to refine it.
Worked example — how four clusters become four UI roles
Suppose the four clusters come out as #F8FAFC, #7F77DD, #E8E8F0 and #2C2B30. The role step computes a simple luminance for each (0.98, 0.50, 0.91, 0.17), sorts them darkest to lightest, and checks the lightest: 0.98 is above the 0.65 threshold, so this is treated as a light theme — background becomes #F8FAFC and text becomes #2C2B30. Of the two remaining colours, #7F77DD is far more saturated (0.60 versus 0.21), so it becomes the accent and #E8E8F0 the secondary. The output order is [background, accent, secondary, text]: #F8FAFC, #7F77DD, #E8E8F0, #2C2B30.
How the calculation works
The file is read with FileReader into a local data URL and drawn onto a 100×100 canvas; the pixels are then read back with getImageData. Every third pixel is sampled, and pixels with alpha below 180 are skipped. Each sampled pixel is compared against existing clusters by Euclidean distance in RGB; if it falls within 65 units of the first matching cluster, the cluster's average is updated, otherwise a new cluster starts. Clusters are then ranked by how many pixels they captured and the top four become the palette.
Limitations
- Your image is never uploaded. It is read locally with FileReader, drawn to a canvas in the page and sampled with getImageData; no request in this tool carries the file anywhere.
- The image is downscaled to 100×100 before sampling, so small accents — a logo mark, an eye, a single button — are usually lost.
- Only every third pixel is sampled, and clusters are built greedily with a fixed RGB distance of 65 and never re-centred, so gradients can split into many small clusters while two distinct colours can merge.
- Transparent pixels are ignored. A PNG logo on transparency often yields fewer than four colours, and the empty slots are filled with fixed fallbacks (#FFFFFF, #4285F4, #EA4335, #34A853) that are not from your image.
- Four colours maximum, with no sensitivity or count control.
- The role assignment decides light or dark from the lightest cluster only, and does not test contrast ratios — a palette can be sorted sensibly and still be unreadable.
- Animated GIFs use the first frame, and HEIC files are not decodable by most browsers.