Skip to main content

Image Color Picker

Extract exact pixel colors from uploaded images or pasted clipboard screenshots across HEX, RGB, HSL, HWB, and CMYK formats.

Upload, Drag & Drop, or Paste an Image

Click here to select a file or paste instantly from your clipboard.


Technical Architecture: Reverse-Engineering In-Browser Pixel Color Sampling​

Extracting precise color values from raster images without blurry interpolation requires low-level canvas coordinate translation and direct pixel buffer access via the HTML5 Canvas API.

1. Viewport-to-Canvas Coordinate Translation & Sampling​

When a user hovers or clicks on a scaled image element, CSS dimensions rarely match the source image's native pixel grid. The sampling engine maps screen coordinates to native image pixels before querying CanvasRenderingContext2D.getImageData():

function samplePixelColor(
canvas: HTMLCanvasElement,
clientX: number,
clientY: number
): { hex: string; rgb: string } {
const rect = canvas.getBoundingClientRect();
const scaleX = canvas.width / rect.width;
const scaleY = canvas.height / rect.height;

// Compute exact native pixel coordinates
const x = Math.floor((clientX - rect.left) * scaleX);
const y = Math.floor((clientY - rect.top) * scaleY);

const ctx = canvas.getContext('2d', { willReadFrequently: true });
if (!ctx) throw new Error('Canvas 2D context unavailable');

// Extract 4-byte RGBA buffer at (x, y)
const pixel = ctx.getImageData(x, y, 1, 1).data;
const r = pixel[0];
const g = pixel[1];
const b = pixel[2];

const hex = `#${[r, g, b].map((c) => c.toString(16).padStart(2, '0')).join('')}`;
return { hex, rgb: `rgb(${r}, ${g}, ${b})` };
}

2. High-Precision Magnifying Loupe & EyeDropper API​

To enable pixel-perfect selection of fine 1px UI borders or icon accents:

  • 11×11 Magnifying Loupe: An auxiliary floating canvas extracts a localized $11 \times 11$ pixel neighborhood around the cursor and scales it with image-rendering: pixelated to eliminate antialiasing blur.
  • Modern EyeDropper API: In supporting browsers (Chrome, Edge, Opera), the tool can invoke native system-level color sampling across any desktop window or browser element outside the canvas viewport.

Image Sampling Capabilities & Specifications​

FeatureTechnical SpecificationOperational Note
Input MethodsFile selector, drag-and-drop, direct clipboard paste (Ctrl+V / Cmd+V)Supports PNG, JPG, WebP, SVG, AVIF, BMP
Inspection Precision11×11 zoomed magnifying loupe with centered reticleDiscrete pixel inspection without blurring
Color SpacesHEX, RGB, HSL, HWB, CMYKOne-click clipboard copy for each format
Session Palette HistoryUp to 10 recently sampled color swatchesPreserved locally in client session memory

Client-Side Security & Zero-Server Data Isolation​

  • 100% Client-Side Canvas Processing: All image rendering, scaling, and pixel sampling execute locally in browser memory. Uploaded design mockups, confidential screenshots, or private photos are never uploaded or stored on any server.
  • No Telemetry on Media: Images and sampled pixel values are completely isolated from tracking scripts.
  • Heap Cleanliness: Object URLs and temporary canvas buffers are revoked when a new file is loaded to prevent browser memory leaks.

Get notified about updates to this tool

No spam. Just high-quality updates about new features and guides.