imgglide

Get color code from image: a pixel or a palette?

You have a photo and you need the exact color in it, as a code you can paste into a design, a stylesheet or a slide. This guide shows how to get color code from image files, when to read one pixel and when to ask for a palette, and why two spots on the same wall never match.

Last updated:

Decide what you mean by the color in this photo

Before you click anything, ask which color you want. A logo on a flat background has one answer. A sweater, a sunset or a painted wall has hundreds, because light falls unevenly across it. If you want to get color code from image areas like these, you are not looking for the color of the object, only for a color that represents it well enough.

Two jobs hide behind the same search. The first is matching: you need a code that sits next to the real thing, such as paint, a brand shade or a fabric. The second is borrowing: you like the mood of a picture and want a handful of colors to build a page around. The first is a single-pixel job. The second is a palette job. Mixing them up is the usual reason the result feels wrong.

One pixel or a palette: which to use

A single pick reads exactly one pixel. That is ideal for a flat, clean area such as a logo, an interface screenshot or a product shot on a plain backdrop, where neighboring pixels are almost identical. It is risky on skin, fabric, foliage or a grainy night shot, where neighbors differ and one pick can land on a speck of noise.

A palette summarises the whole picture instead. Here the image color picker looks at the picture and groups similar colors, then lists between 5 and 10 dominant ones with the share of the picture each covers. It is the right tool for the question what colors does this photo use, and the wrong tool when you need the one precise shade of a particular object. For a real object in a real photo, pick several nearby pixels and compare.

Advertisement

How to get color code from image files, step by step

Everything runs in your browser. The picture is not uploaded, nothing has to be installed, there is no sign-up and no watermark. The names below are the ones on the color picker page.

  • Press ‘Choose a file’ or drop the picture on the page. For a screenshot, paste it with Ctrl+V, or Command+V on a Mac, or use ‘Paste image’ when your browser shows it.
  • Move over the picture. On a computer a magnifier follows the pointer and shows an 11 × 11 grid of pixels with the target boxed. On a phone, press, hold and drag, then lift your finger to pick.
  • Click the spot. Under ‘Picked color’ you now see ‘HEX’, ‘RGB’, ‘HSL’ and ‘CMYK (approx.)’, each with its own copy button.
  • For a palette, scroll to ‘Main colors’, set ‘Colors’ between 5 and 10 and click any swatch to see its codes.
  • Use ‘Copy HEX list’, ‘Copy as CSS’ or ‘Save as PNG’ to take the palette away. ‘Open another image’ loads the next one.

Why the same wall gives different codes

Take two spots a few centimeters apart on one painted wall in a photo, and the codes will differ. Part of the reason is real: one spot is lit more strongly, another sits in a soft shadow, and a window adds a cool tint. The camera also decides how bright and how warm the whole picture should look, so the wall in the photo is rarely the wall in the room.

The rest is noise. A JPG stores small blocks of pixels in a simplified form, which adds tiny random shifts in flat areas, and a phone photo taken in dim light carries grain on top of that. None of this is a mistake in the reading. The pixel really has that value. It is just not the value you had in mind.

Reading HEX, RGB and HSL without guessing

HEX and RGB are the same number written two ways. Each of red, green and blue runs from 0 to 255, and HEX writes each one with two characters from 00 to FF. So #E4572E is red 228, green 87, blue 46. When all three channels are equal the color is a gray, which is a quick way to see whether a pick is neutral.

HSL describes the same color as hue, saturation and lightness, which is easier to adjust by hand: keep the hue, and lower the lightness for a darker version. When a pixel is partly transparent, as in a cut-out PNG, the tool adds opacity and writes an eight-digit HEX, so the extra pair of characters is the transparency, not a typo. Copy whichever format your destination asks for.

Screen colors and printed colors are not the same

A screen mixes light, a printer mixes ink, and the two cannot show exactly the same range. The values here are in sRGB, the color space browsers use. The CMYK line is only calculated from the RGB values, which is why the label says approximate. Use it as a starting point, never as an instruction to a print shop.

Your own display matters too. A different brightness setting, a warm night mode or a cheap panel will make the same code look different on two devices, even though the number is unchanged. If a color must match a physical object, a printed proof next to the object is the only honest test.

Getting a cleaner result

Use the biggest, least compressed version of the picture you have, because a small, heavily saved file has more noise per pixel. Pick three or four neighbors around the spot you care about and keep the one that sits in the middle of them. If a photo looks too dark or too yellow, the Photo editor can adjust light and warmth first, though you then read the corrected picture, not the original.

If the file is in a format your next tool does not open, Image converter turns it into a JPG or PNG of the same pixel size. Remember that a lossy JPG save shifts colors by a small amount, so read the code from the original when you can. And if you share the picture, the EXIF viewer shows what else it carries.

What this tool cannot do

Each pick is one pixel. There is no averaging over an area, no color name lookup and no conversion to a print profile. The CMYK values are an estimate. Pictures above 16.7 megapixels are reduced first and read from the reduced copy, and the palette is worked out on a copy cut down to 256 pixels on the long side, so tiny details do not influence it.

‘Pick from screen’ only appears in browsers that provide an eyedropper, and it reads what is visible on your display, not a file. Recent picks, up to twelve, are kept as hex codes in this browser only, and ‘Clear’ empties them.

Questions and answers

How do I get color code from image files on a phone?

Open the picture, then press and hold on it and drag to see the magnifier above your finger. Lift your finger and the HEX, RGB and HSL values appear under ‘Picked color’.

How can I find the HEX code from a photo of a real object?

Pick several pixels on the object and compare them. Light, shadow and camera settings change the value, so choose the middle one rather than the first.

Can I extract colors from an image as a list?

Yes. ‘Main colors’ gives 5 to 10 dominant colors with their shares, and ‘Copy HEX list’ puts one code per line on your clipboard.

Why does my printed color look different from the code?

Screens use light and printers use ink. The CMYK line is only an approximation worked out from RGB, so ask for a proof.

Is the picture sent anywhere?

No. It is read inside your browser and is not uploaded.