# Image Color Picker and Palette Extractor

> Read the hex, RGB and HSL code of any pixel in a photo, find its main color, or pull a palette of 2 to 12 shades with each one's share of the picture.

Use it online (free, runs in your browser): https://directory.milunir.com/color-tools/color-pickers/image-color-picker-and-palette-extractor/

Choose a picture, then type the pixel position to read its color: in a logo whose square is red 30, green 120, blue 220, pixel (10, 10) gives #1E78DC, rgb(30, 120, 220) and hsl(212, 76%, 49%). Main color reports the most common shade, and Palette lists up to 12 shades with their share.

Designers matching a brand blue, web developers copying a shade into CSS, and knitters planning a colorwork chart all need the same thing: the exact code of a color they can see in a picture. This picker has three jobs. Pick a pixel reads the color at a position counted from the top-left corner, with its opacity. Main color finds the shade that covers the most visible area. Palette groups similar shades and lists 2 to 12 of them, largest first, with a copy button beside each hex code. The picture is decoded in your browser and never uploaded. One limit: JPG compression shifts pixels by a few units, so a flat area in a JPG may read #FEFEFE rather than pure white, and a PNG of the same image is more faithful.

## How to use

1. **Choose the picture**: Press Choose image or drop a JPG, PNG, WebP, GIF or BMP file on the box.
2. **Pick the job**: Pick a pixel, Main color or Palette. For a pixel, type how far it is from the left and from the top, starting at 0.
3. **Copy the code**: Read the hex code with its RGB and HSL forms. In Palette, use the copy button on any row and move the slider for more or fewer colors.

## Examples

### Read one pixel of a logo

- Mode: Pick a pixel
- Pixel from the left: 10
- Pixel from the top: 10
- Number of colors: 6
- Image: fixture:logo-200x100-alpha.png

Result: Color: #1E78DC RGB: rgb(30, 120, 220) HSL: hsl(212, 76%, 49%)

Pixel 10 across and 10 down sits inside the logo's solid blue square, which was drawn as red 30, green 120, blue 220. In hex that is #1E78DC.

### Find the main color of a logo

- Mode: Main color
- Pixel from the left: 0
- Pixel from the top: 0
- Number of colors: 6
- Image: fixture:logo-200x100-alpha.png

Result: Color: #1E78DC RGB: rgb(30, 120, 220) HSL: hsl(212, 76%, 49%)

Half of this 200 × 100 logo is see-through and is skipped. Of the visible pixels, the blue square is far larger than the red-orange circle, so blue #1E78DC is the main color.

### Ask for 6 colors from a two-color logo

- Mode: Palette
- Pixel from the left: 0
- Pixel from the top: 0
- Number of colors: 6
- Image: fixture:logo-200x100-alpha.png

Result: Color: 2 colors

The logo holds only a blue square and a red-orange circle, so the palette lists those two with their shares and notes that it is shorter than the 6 asked for.

## How it works

`hex = # + R, G, B each as two base-16 digits; share = pixels in a color group ÷ visible pixels × 100`

- `R, G, B`: red, green and blue levels of a pixel, 0 to 255
- `visible pixels`: pixels at least half opaque (alpha of 128 or more)

The picture is turned upright from its EXIF orientation and read as raw red, green, blue and alpha values. A picked pixel is reported as it is stored, before any blending with the page behind it. For the main color and the palette, each visible pixel goes into one of 4,096 bins (16 levels per channel), each bin is averaged, and bins are taken biggest first; a bin within 48 units of a larger kept color joins that color instead of starting a new one, so JPG noise and soft edges do not split one shade into many. Very large pictures are read as an even sample of about 300,000 pixels. HSL follows the CSS Color Module Level 4 conversion, rounded to whole degrees and percent.

Sources:

- [CSS Color Module Level 4](https://www.w3.org/TR/css-color-4/), W3C

## When not to use it

- Printing to exact ink: a screen RGB code does not give a CMYK or Pantone match.
- Reading a color off a screenshot of a phone in night mode, which shifts every pixel warmer.

## Common mistakes

- Counting pixel positions from 1; the first column and row are 0.
- Sampling a JPG edge, where compression blends two neighboring colors into a third.
- Treating a semi-transparent pixel's code as what it looks like on a white page.

## Questions

### What does dominant color mean in an image?

The dominant color is the shade that covers the largest share of the visible picture. Here similar shades are grouped first, so a sky with slight noise counts as one blue rather than hundreds of near-identical codes. Transparent areas are left out, which is why a logo on a clear background reports its ink, not the empty space around it.

### How is the dominant color extracted from a photo?

Every visible pixel is sorted into one of 4,096 bins by its red, green and blue level, each bin is averaged, and bins within 48 units of a larger group are merged into it. The biggest group is the dominant color, shown with its share of visible pixels. Palette mode lists the next largest groups too.

### What is the dominant color in stranded knitting?

In stranded or Fair Isle knitting, the dominant color is the yarn carried so it sits slightly lower and looks larger in the fabric, usually the pattern color. That is a hand-position choice, not a measurement. This picker helps a step earlier: it reads the main and supporting shades from a chart or photo so you can match yarns to them.

### How do I choose the dominant color for colorwork knitting from a picture?

Open the photo or chart, run Palette with 2 to 4 colors and compare the shares. Many knitters make the color that should stand out, often the smaller-share motif color, the dominant yarn so the pattern pops. The hex and RGB codes help match yarn cards on screen, though dye lots look different in daylight.

### How can I find the color of a single pixel?

Choose Pick a pixel and type its position: pixels from the left edge and from the top edge, both starting at 0. In an image 1920 wide, the last column is 1919. The result gives the hex code, rgb() and hsl() forms, and warns if the pixel is partly or fully transparent.

### Do I need to download a pixel color picker for Windows or Chrome?

No install is needed for colors inside a picture: this page decodes the file in the browser on Windows, Mac or a phone, and nothing is uploaded. To sample colors from other apps on the screen, save a screenshot first, then open that file here.
