Image Color Picker
Click any point of an image to read its colour in four formats, extract a palette as CSS variables and see the WCAG contrast with white and black text.
Last checked
Files never leave your device. Everything runs in this tab.
Click the image
Picked colour
How to use it
- Drop an image, choose a file or paste a screenshot with Ctrl+V. It stays in this tab.
- Click or drag on the image and watch the magnifier, or focus the image and move with the arrow keys. Hold Shift to move ten pixels at a time.
- Copy the format you need, or copy the whole palette as CSS variables.
What it checks and why
A single pixel in a photo is rarely the colour you think you are looking at. JPEG compression and sensor noise make neighbouring pixels differ, so the exact pixel can be an outlier. For a logo or a screenshot the exact pixel is what you want. For a photo, switch the sample to a 3 x 3 or 9 x 9 average, which reads the colour your eye reads. Fully transparent pixels are left out of the average.
The palette uses median cut, a classic colour quantisation method from Paul Heckbert's 1982 paper. All pixels start in one box in RGB space. The box with the widest colour range is split at its median pixel along that range, and this repeats until there are as many boxes as colours you asked for. Each swatch is the average of its box, and the percentage is its share of the image. A small bright accent can disappear into a larger box, so pick it by hand when it matters.
Each colour is shown with its contrast against white and black, using the WCAG 2.2 formula and truncated instead of rounded up, so you can see at once which text colour works on it. To test the colour against anything else, open the pair in the Contrast Checker. The OKLCH value is useful when you want to build lighter and darker steps of a colour you found, and the OKLCH Converter does that from here.
Specs and sources
Limits
- Picking from outside the page uses the EyeDropper API, which Chrome, Edge and Opera support and Firefox and Safari do not. The button only shows where it works.
- Images are read at up to 1600 px on the longest side, so a pixel position in a larger image is an approximate one, and its colour is slightly blended.
- Colours are read as sRGB through the canvas. A wide-gamut photo is converted, so a vivid Display P3 colour reads as the nearest sRGB value.
- The palette ignores pixels under 50% opacity, and semi-transparent pixels are read as stored, without the background they would sit on.
- HEIC files open only in browsers that can decode them, which is mostly Safari. Convert them first anywhere else.
Questions
- Can I pick a colour from my screen, not an image?
- In Chrome or Edge, press Pick from screen and click anywhere on the screen. In other browsers take a screenshot and paste it here with Ctrl+V.
- How do I get the HEX code of a colour in an image?
- Drop the image here and click the colour. The HEX code appears on the right with a copy button, next to RGB, HSL and OKLCH. Nothing is uploaded, because the page reads the pixels in your browser.
- Why does the same area give me different colours?
- Photos are noisy and JPEG compression changes neighbouring pixels, so each pixel can differ a little. Set the sample to a 3 x 3 or 9 x 9 average to read the colour of the area instead of one pixel.
- How do I get a colour palette from an image?
- Load the image and the palette appears under it. Choose 4, 6, 8 or 12 colours, click a swatch to read it in all formats, and copy the set as CSS custom properties for your stylesheet.
- Should I use white or black text on this colour?
- The tool shows both ratios and names the higher one. Normal text needs at least 4.5 to 1 for WCAG AA. On some mid-tones only one of them passes, and on a few neither reaches AAA.