Convert Image to RGB Values

Extract RGB values from images - dominant colors, unique palette, 7 output formats (CSS/Python/NumPy/JSON). Free, offline, client-side.

Extract pixel RGB values as Dominant top-K, full Unique palette, regular Grid sample, or Linear stride. Output as CSS rgb()/rgba(), plain CSV, Python tuples or arrays, JSON, or a NumPy literal. Optional alpha channel.

Drop image here or click to upload
PNG, JPG, GIF, BMP, WebP
Drop an image or click to upload.

How to Use Convert Image to RGB Values

  1. Drop or upload a PNG/JPG/GIF/BMP/WebP. Files stay in your browser; nothing is uploaded.
  2. Pick a mode - Dominant runs frequency analysis on bucketed colors (best for design palettes). Unique returns every distinct RGB triple. Grid samples at regular N×N points (lightweight palette). Linear strides through the pixel array (original behavior, kept for backwards compatibility).
  3. Adjust Top-K - 4 to 64 entries to return. 8 is the usual palette size; bump to 64 for full asset audits.
  4. Tune quantization (Dominant only) - 4 bits aggressively merges similar shades; 8 bits keeps every distinct color. 6 bits is the sweet spot for most palettes.
  5. Toggle alpha - off by default (RGB only). Turn on for RGBA tuples; alpha appears as 0-255 in plain formats and as 0.0-1.0 in CSS rgba().
  6. Pick an output format - CSS rgb() or rgba() for stylesheets, plain CSV for spreadsheets, Python tuple or array literal for scripts, JSON for config files, or a NumPy literal for image-processing pipelines.
  7. Click swatches or Copy/Download - click any color tile to copy that one swatch in the active format. The Copy button copies the entire formatted output; Download saves it as .txt / .json / .py depending on format.

Frequently Asked Questions

How is this different from the hex-codes sibling tool?

Same extraction modes, different output formats. The hex-codes tool outputs #RRGGBB strings (best for CSS palettes); this RGB tool outputs decimal triples in seven formats including NumPy literals, Python tuples, and JSON. Pick whichever matches your downstream tool – they share the same underlying math.

What does the alpha channel option do?

With alpha on, RGBA tuples are output instead of RGB. Plain formats show alpha as 0-255 (matching the underlying byte); CSS rgba() shows it as a 0-1 float (per the CSS spec). Fully transparent pixels (alpha = 0) are still skipped, so the alphas you see are all 1+.

Why does the NumPy output include dtype=np.uint8?

Because raw pixel RGB is 8-bit unsigned (0-255). Without an explicit dtype, NumPy might infer int64, which wastes 8× the memory. np.uint8 matches the source data exactly and lets you paste-into-pipeline ready for cv2.cvtColor, PIL.Image.fromarray, etc.

What are typical use cases for this tool?

Design: extract brand palettes for moodboards. Programming: get a starter array for procedural art or shader uniforms. Image processing: pull a representative palette for posterization, dithering, or k-means clustering input. Data viz: convert image samples into a chart color scheme.

How is “Dominant” computed?

Each pixel’s RGB is rounded to one of 2^bits levels per channel (e.g., 6 bits → 64 levels). Quantized triples become Map keys. We count frequencies as we walk the pixels, then sort descending by count and return the top K buckets. The reported color is the quantized representative – not necessarily a literal pixel value.

Are transparent pixels included?

Fully transparent pixels (alpha = 0) are skipped – they have no visible color contribution. Semi-transparent pixels (alpha > 0) contribute their RGB at full intensity and their alpha (if alpha output is enabled).

What’s the difference between “Grid” and “Linear” modes?

Grid samples N×N points at regular x,y coordinates (10×10 = 100 evenly-spaced samples). Linear strides through the underlying byte array in row-major order, which means clustered samples for small N. Grid is usually what you want; Linear is kept for backwards compatibility.

Is my image data uploaded?

No. FileReader, Canvas 2D, and histogram loops all run in your browser. Open DevTools → Network and watch zero requests fire after the page loads. Safe for proprietary brand work or sensitive imagery.

Why does Python tuple format have no , at the end?

Each tuple is on its own line, ready to be pasted into a Python list literal: colors = [(255,128,64), (33,193,255), ...]. We don’t include the outer brackets so you have flexibility on how to wrap it.

Does it work offline?

Yes. Total bundle is under 20 KB. Once loaded, disconnect and keep extracting. Works on planes, trains, or air-gapped machines.