FLXCode Color Picker from Image

FLXCode apps

Appearance

Color Picker from Image

Click a picture to read the color of any pixel as HEX, RGB and HSL. The picture stays on your device.

or drop one here, or paste with Ctrl+V

JPG, PNG, WebP, GIF, BMP or AVIF. It stays on this device.

Colors are read as the browser shows them (sRGB). Nothing is uploaded, and the picture is not saved.

No ads. No account. Nothing you type or record is uploaded. We count page events with a daily code. Check it.

Problem or idea? Email us

Quick start

  1. Choose a picture, drop it on the page or paste a screenshot.
  2. Click or tap a point. Drag to slide the marker. Use the magnifier to land on the exact pixel.
  3. Copy the HEX, RGB or HSL line, or press Keep this color to put it in your list.
  4. Below the picture, pick 5 to 8 dominant colors and copy them as CSS or JSON.

Worked examples

The same color in the three formats the tool shows. These rows come from the tool's own code.

HEXRGBHSL
#1D5FC2rgb(29, 95, 194)hsl(216, 74%, 44%)
#E8A33Drgb(232, 163, 61)hsl(36, 79%, 57%)
#2F8F5Brgb(47, 143, 91)hsl(148, 51%, 37%)
#7A3E9Drgb(122, 62, 157)hsl(278, 43%, 43%)
#F4F1EArgb(244, 241, 234)hsl(42, 31%, 94%)

A test picture with a red band of 5,000 pixels, a green band of 3,000 and a blue band of 2,000, asked for 3 colors, gives #C81E1E (50%), #1EA03C (30%), #143CBE (20%). Exported as CSS:

:root {
  --color-1: #c81e1e;
  --color-2: #1ea03c;
  --color-3: #143cbe;
}

How it works

The picture is drawn on a canvas at its own pixel size. A click is mapped to the pixel under it and that pixel is read back as four numbers: red, green, blue and opacity. HEX is those three numbers in base 16. HSL is worked out from them: the hue is the angle on the color wheel, saturation and lightness are percentages, all rounded to whole numbers. Because of that rounding, going back from HSL to RGB can land one or two steps off.

Dominant colors start from the most common coarse color, add the colors farthest from those chosen, and then run 10 rounds of k-means. The same picture always gives the same palette.

Numbers this uses

  • Palette: up to 20,000 pixels sampled evenly, k from 5 to 8, 10 k-means rounds (this site's code).
  • Pixels with opacity under 128 of 255 are ignored in the palette.
  • Magnifier: 9 x 9 pixels shown at 15 times.
  • HSL is rounded to whole degrees and whole percents (CSS Color Module).
  • File limit 100 MB. Pictures over 16.7 megapixels on an iPhone or iPad, or 100 megapixels elsewhere, are scaled down first (browser canvas limits).

Limits

  • It reads pictures you load here. It can't pick a color from other windows on your screen.
  • Colors are in sRGB. A wide-gamut photo is converted by the browser first.
  • HEIC files are not opened. Convert them to JPG first.

Privacy

Nothing you choose is uploaded or stored. We count events without cookies, such as "color kept" (details).

FAQ

How do I pick a color from an image?

Choose the picture, then click or tap the spot you want. The HEX, RGB and HSL values of that pixel show next to the picture, and a magnifier shows the pixels around it. Press Copy next to the format you need.

How do I get the HEX code of a color in a photo?

Click the color in the photo and copy the HEX line. It is six hex digits after a hash, like #1D5FC2. The same pixel is also shown as RGB (29, 95, 194) and HSL (216, 74%, 44%).

Why does the color look different in Photoshop or on my phone?

This page reads the pixel values the browser decodes, converted to sRGB. A program that uses another color profile, a screen with a different calibration or a JPG that was compressed can show a slightly different color. One pixel in a photo also carries noise, so the dominant colors are a steadier guide.

Can I pick a color without a mouse?

Yes. Tab to the picture, move the marker with the arrow keys (Shift moves 10 pixels), and press Enter to keep the color. Home and End jump to the left and right edge of the row.

How are the dominant colors chosen?

The page samples up to 20,000 pixels spread over the picture and groups them with k-means clustering into 5 to 8 groups. Each swatch is the average color of its group, and the percentage is the share of sampled pixels in it. Almost transparent pixels are left out.

How do I use the palette in CSS?

Choose CSS under Export the palette and copy it. You get a :root block with custom properties like --color-1: #1d5fc2. Use them as var(--color-1). JSON gives HEX, RGB, HSL and the share for each color.

Can I pick colors from a screenshot, or from the clipboard?

Yes. Paste a copied screenshot with Ctrl+V (Cmd+V on a Mac) or drop the file on the page. Screenshots are lossless, so the colors are exact.

Is my picture uploaded?

No. The picture is decoded and read by your browser on this device. It is not sent, saved or put in the address bar. To check, load the page, switch to airplane mode and pick a color.

More from FLXCode

Share Color Picker from Image