Image Color Picker & Palette Extractor

Pick HEX, RGB and HSL colors from image pixels. Extract a weighted palette, inspect transparency and export JSON or CSS locally in your browser.

Drop one image here.

Pick one pixel or build an image palette

Choose a local PNG, JPEG, WebP or GIF. The image opens with a palette and a selected pixel. Click or tap the image to read that pixel, or enter X and Y for a precise location. The built-in example contains opaque red and green, translucent blue and a transparent strip, so you can compare the two transparency modes.

Single-pixel values answer “what color is here?”; the palette groups sampled colors into a small set for a stylesheet or design reference. Both workflows share the same image. Copy an individual swatch, copy the selected pixel in HEX/RGB/HSL, or download a JSON report or CSS custom properties. Your image is processed by a local browser Worker and is not uploaded by the tool.

Coordinates, orientation and the pixel zoom

Coordinates start at the top-left of the decoded image: X runs from 0 to width − 1 and Y from 0 to height − 1. Clicking a scaled preview maps back to that pixel grid. Focus the image and use arrow keys for one-pixel steps, Shift for ten pixels, Home/End for the row edges, and Ctrl or Command with Home/End for the image corners. The X/Y fields provide the same access without a pointer.

The browser applies image orientation metadata before coordinates are assigned. The zoom shows a 9 × 9 neighborhood with the selected pixel outlined. It uses nearest-neighbor display; that outline and the preview marker never alter the source pixels. Animated inputs use the format’s default image, or its first frame when no separate default exists. An APNG poster can differ from the first animation frame. Frames are not combined over time; GIF always displays the single-frame notice.

For APNG, the tool keeps the original PNG default-image IDAT and non-animation chunks, including color information, and removes animation-only acTL/fcTL/fdAT chunks before decoding. This prevents a browser from silently skipping a separate poster image. Your original file is unchanged.

HEX, alpha, RGB and HSL

Opaque selections copy a six-digit #RRGGBB value. Translucent or transparent selections copy #RRGGBBAA so opacity is retained. The report includes both forms and the original alpha byte from 0 to 255. CSS rgb() and hsl() values include alpha when needed; displayed HSL and alpha percentages are rounded to four decimal places.

Values come from an 8-bit sRGB canvas after browser decoding and color-profile conversion. They are not a forensic read of compressed file bytes or wide-gamut/HDR measurements. Premultiplied-alpha conversion can change low-opacity RGB values; fully transparent pixels may return black even if the file stored another hidden color. Use the alpha-aware copy when pasting into CSS.

How palette extraction works

The extractor builds a five-bit-per-channel RGB histogram, then repeatedly splits a color box along its longest channel range near the weighted median. Boxes with a larger weight-times-range score are split first, with fixed tie rules. Each output color is the weighted mean of the original eight-bit channel values in its box, rounded to a byte. Colors are sorted by descending share.

Choose 1–16 colors. Nearby shades can share one histogram cell, so a picture may produce fewer swatches than requested. A representative mean does not have to occur as an exact pixel in the image. This deterministic median-cut variant is an approximation in encoded sRGB, not a perceptual clustering model, color-harmony recommendation or complete inventory of distinct colors.

Transparency and what the percentages mean

Weight by alpha ignores fully transparent sampled pixels and gives a half-opacity pixel roughly half the weight of an opaque one. Shares are the sum of alpha-byte weights in a box divided by the total weight. Palette swatches are opaque representative RGB colors; their percentage describes weighted coverage, not a recommended CSS opacity.

Composite over background first blends each sampled pixel with your six-digit background HEX using round((channel × alpha + background × (255 − alpha)) / 255). Every sample then has equal weight, including transparent pixels which become the background. This is encoded-sRGB channel blending, not linear-light mixing. Try both white and black backgrounds when a logo or overlay has transparency.

Sampling and small color details

Images with at most 65,536 pixels use every pixel for the palette. Larger images use a regular two-dimensional grid with at most 65,536 center samples. The report records grid dimensions, sample count, whether every pixel was used, transparency counts and alpha weights. The picker still reads the full-resolution decoded pixel; it does not read a palette cell.

Regular sampling can miss thin lines, rare colors or repeating patterns. The percentages describe the sampled color boxes under the selected transparency rule. They are not exact original-image pixel frequencies, confidence intervals, or nearest-color assignments of every full-resolution pixel. Crop a region first if a small subject matters more than the whole picture.

Use the export in a stylesheet

CSS export creates --image-color-1, --image-color-2 and subsequent custom properties inside :root. Names follow the current share order. JSON includes image dimensions, source format, default-image/first-frame policy, the current selection and all palette statistics. Switching export formats does not change your image or extraction settings.

Extracted colors can help choose a starting theme, but an attractive photo palette does not establish readable text contrast. Check foreground/background pairs separately. Use the image cropper for a region, the image resizer for dimensions, and the color converter for further color-format work.

Limits, cancellation and local processing

One input file may be at most 20 MiB, 16 million decoded pixels and 10,000 pixels on either side. Dimensions are checked before native decoding and again afterwards. The browser must support image decoding and OffscreenCanvas in a Worker. Decoding, pixel readback and palette extraction have a 15-second deadline; Cancel terminates the disposable Worker.

Changing a palette option invalidates its previous report until you extract again. Selecting a new file or clearing the page discards old image state and ignores late results. The tool does not save images to local storage or send them to an image API. Decoded bitmaps and pixel buffers can still use substantial memory; these limits are not a guarantee of a fixed total browser-memory footprint.

FAQ

Why does a palette color differ from the pixel I clicked?

The picker reads one decoded pixel. A palette color is a weighted mean of a group of sampled colors, so it can differ from every individual source pixel.

Why does a transparent logo produce a different palette on black?

Alpha-weighted extraction describes visible RGB coverage without a background. Compositing explicitly mixes those pixels with black or another chosen background and includes transparent areas in the shares.

Are image files uploaded or published?

The tool decodes local files and extracts colors in your browser. It does not upload the image or create a public image URL.

Can I recover the original color hidden under zero alpha?

No. Browser canvas decoding can discard hidden RGB and can round translucent channels. The output describes the decoded sRGB pixels, not lossless original-file channel values.

Other Languages

Image Color Picker & Palette Extractor — Base64.sh

Image Color Picker & Palette Extractor

Pick HEX, RGB and HSL colors from image pixels. Extract a weighted palette, inspect transparency and export JSON or CSS locally in your browser.

Share:

References

How we make sure

We check this tool with the automated test suites linked below. Example checks are shown in their original language.

Verification method
Construct known-pixel images and compare RGB/HSL, alpha, population shares, compositing and quantization.
Comparison reference
Independently specified RGB/HSL vectors and exact pixel counts.
Verification scope
These samples and boundaries do not prove correctness for every input.
Test source and cases (select a file to read it)
  • image-color-tools.test.js
    • image colors: dimension limits permit documented boundaries and reject invalid/oversized allocations
    • image colors: palette settings are strict and dormant backgrounds do not reject valid alpha coverage
    • image colors: independent standard RGB/HSL primary and achromatic vectors
    • image colors: alpha-weighted shares match independent exact red/green/translucent-blue counts
    • image colors: encoded-sRGB compositing has independent byte expectations on white and black
    • image colors: histogram representatives average original 8-bit values rather than quantized bin centers
    • image colors: median-cut groups an independent four-tone grayscale vector and honors color counts
    • image colors: full histogram returns bounded colors, conserves coverage and never mutates source data

These checks cover the listed examples and boundaries, not every possible input. Round trips and checks using the same library are not independent verification.