How to use the Color Picker from Image
- 1Upload or drop an image.
- 2Click the image to pick a colour, or focus it and use the arrow keys and Enter.
- 3Copy the HEX, RGB or HSL code.
- 4Use the dominant colours palette for a ready-made colour scheme.
What is a color picker from image?
A color picker from image is an eyedropper for photos and screenshots. You upload a picture, click any point, and get that pixel's exact colour code in HEX, RGB and HSL. This tool also finds the most common colours in the whole image, giving you a ready-made palette. It runs in your browser, so your image is never uploaded.
Designers use it to match a brand colour from a logo, developers use it to copy a colour from a screenshot into CSS, and anyone decorating a room or choosing clothes can use it to name a colour they like.
How does the colour picker work?
When you choose an image, the tool draws it onto an HTML canvas. A canvas lets JavaScript read the colour of any pixel with getImageData(), which returns four numbers from 0 to 255: red, green, blue and alpha (opacity).
When you move the pointer, the tool works out which canvas pixel is under it (scaling for the display size), reads those numbers and shows the colour live. Clicking locks the colour so you can copy it. You can also use the keyboard: focus the image, move with the arrow keys (hold Shift for 10-pixel steps) and press Enter to pick.
How the codes are calculated
- HEX writes red, green and blue as two hexadecimal digits each. RGB (15, 105, 87) becomes
#0f6957. - RGB shows the three numbers directly:
rgb(15, 105, 87). - HSL converts to hue (0 to 360 degrees on the colour wheel), saturation and lightness (both 0 to 100%). The same colour is
hsl(168, 75%, 24%).
All three describe exactly the same colour. Use whichever your software asks for.
How is the dominant palette found?
The tool samples pixels across the image and groups similar colours. Each red, green and blue value is reduced to 16 levels, which gives 4,096 colour "buckets". It counts how many pixels fall into each bucket, takes the busiest eight, and shows the average real colour inside each. Fully transparent pixels are ignored.
This is a fast and simple method. It is good for finding the main colours of a logo or product photo, but it does not group colours the way a person would. A photo with a big grey background will show several greys at the top of the palette.
Worked example
You have a screenshot of a competitor's button and want the same green.
- Upload the screenshot.
- Click in the middle of the button, away from the text and the rounded edge.
- The tool shows, for example, HEX
#1fa382, RGBrgb(31, 163, 130). - Click Copy next to HEX and paste it into your stylesheet.
If you click on the anti-aliased edge of the button you may get a lighter, mixed colour such as #8fd1c0. That is why picking from the flat centre matters.
Tips
- Pick from flat areas. Photos contain noise, shadows and JPG artefacts. Try two or three nearby points and choose the one that looks right.
- Use the original image, not a compressed copy. Heavy JPG compression changes colours slightly.
- Check contrast before using a colour for text. Paste it into the Color Palette Generator, which also builds matching colours from it.
- Turn the palette into a background with the CSS Gradient Generator, or add depth with the Box Shadow Generator.
- Need the picture in another format first? Use the Image Converter.
Limitations
- Screen colour is not real-world colour. A photo of a wall depends on light, camera and screen. Paint shops match from physical samples for good reason.
- Colour profiles: images in wide-gamut profiles such as Display P3 are converted to standard sRGB when drawn, so very saturated colours can be reported slightly duller than they appear in some apps.
- Large images are scaled to 1,200 pixels wide for speed. Single-pixel details in huge images may blend with neighbours.
- The palette is approximate, as explained above.
Key terms
- HEX code: a six-digit code for a colour used in web design, such as
#fffffffor white. - Hue: the position of a colour on the colour wheel (red, yellow, green and so on).
- Saturation: how strong or grey a colour is.
- Lightness: how close a colour is to black or white.
Frequently asked questions
Why does the picked colour look different from what I see?
Photos contain noise and gradients, so neighbouring pixels can differ. Pick from a flat area for a more representative colour.
How is the palette worked out?
Pixels are grouped into similar colour buckets and the most common buckets are shown, averaged. It is a quick method, not a perfect one.
What is the difference between HEX, RGB and HSL?
They describe the same colour in different ways. HEX and RGB give red, green and blue amounts; HSL gives hue, saturation and lightness, which is easier to adjust by hand.
Is the image uploaded?
No. Pixels are read from a canvas in your browser.
Last updated: . Written and tested by Abdul Moid Khan, ATechCraft. Read how we build and test tools.