AI tooling · image analysis · browser-local · 2026 · Solo — image analysis algorithm design, median cut quantization, Sobel edge detection, TDD, exact-SHA deployment

Chroma Stamp

A Command/Inspect surface that turns real pixel data into a structured GPT-Image-2 style prompt using client-side computer vision.

The problem

GPT-Image-2 is extremely prompt-sensitive. The difference between a generic result and one faithful to a reference image is knowing its exact palette, edge character, tonal distribution, and compositional vocabulary. Doing this by eye is slow and imprecise; no existing browser tool performs this analysis without uploading your image to an external server. Chroma Stamp fills that gap. Drop a real local image (JPEG, PNG, WebP) and the tool reads its pixel data via Canvas API entirely client-side — no upload, no account, no API. It runs median cut color quantization to extract the 8 most perceptually representative colors, applies Sobel edge kernels to the luminance channel to compute gradient magnitude and classify edge character as sharp, textured, or soft, buckets all pixel luminosity values into 8 bins to determine tonal key (high-key, low-key, balanced), computes center-vs-periphery and rule-of-thirds intersection ratios to classify composition, then maps every signal to GPT-Image-2 prompt tokens using a domain-specific taxonomy. The concept came from freestylefly/awesome-gpt-image-2, daily rank #1 with 2,449 stars gained on 2026-08-24 and 16,042 total stars — the highest-velocity source of the day, representing clear market demand for GPT-Image-2 tooling. Chroma Stamp translates that demand into original signal-extraction tooling rather than copying prompt lists.

Architecture

Key decisions

01

Median cut over k-means for perceptual color clustering

K-means is sensitive to initialization and can converge on non-representative colors for images with small high-saturation regions. Median cut recursively partitions the actual pixel distribution by the channel with the largest range, guaranteeing that every returned color represents a real cluster of the pixel population. Writing tests first forced an explicit definition of 'representative color' before touching the implementation.

02

Client-side Canvas 2D without WebGL or CV libraries

Running perceptually meaningful image analysis in the browser without GPU acceleration or computer vision libraries required manual kernel convolution for edge detection. The Sobel implementation iterates over every interior pixel, computes horizontal and vertical gradient magnitudes, and averages them — straightforward but exact. This keeps the bundle below 1 KB of analysis code, avoids cold-start latency from heavy CV libraries, and means the tool runs on any device with a modern browser.

03

Declarative prompt taxonomy over template strings

The mapping from image signals to GPT-Image-2 prompt tokens is the most brittle piece of the system and the most testable. A declarative table that maps edge character values, tonal key values, and composition types to specific prompt vocabulary makes the mapping inspectable and independently testable. The TDD tests verify that buildPromptFromSignals produces English output, includes references to tonal key, edge character, composition, and palette, and generates different prompts for different signals.

Metrics

26
TDD unit tests (26/26 pass)
5
pure analysis functions
0
external dependencies in analysis library