What to try
- Inspect the sunset, pale paper or dark lettering and compare distances to the editable ink palette.
- Edit a palette color, then reduce the extracted palette size.
What to look for: The nearest RGB representative wins. One changed swatch can reassign many pixels; the counts and channel error measure that change.
How it works
Median-cut repeatedly divides a sampled color population into boxes and chooses representatives. Popularity favors frequent colors. A uniform palette samples a regular color grid. Each answers a different question: represent the distribution, keep the most common colors, or impose a fixed structure.
After choosing a palette, each pixel is assigned a representative. Error diffusion can distribute the mismatch to later pixels, exchanging flat banding for spatial texture. Posterization is different: it reduces levels independently in each channel rather than choosing a total image palette.
Use it in the Lab
Use Indexed palette for a limited image palette and Posterize for discrete channel levels. Judge important accents and small details as well as average similarity. Quantization can follow a color adjustment to emphasize the values you want the palette to preserve.
Limits & distinctions
The rendered Lab layer remains RGBA even when its colors are quantized. Its PNG export is not promised to use an indexed PNG encoding.
Further reading
Reducing the Palette
Color quantization reduces a full-color image (up to 16,777,216 colors) to a small palette — typically 2 to 256 colors. The challenge lies in choosing which colors to keep and how to map every original color to its nearest palette entry.
Algorithms
Quantization Methods
Median-cut: splits color space along longest axis recursively. Fast and produces good results. K-means: iteratively refines cluster centers. Slower but more accurate. Octree: uses a tree data structure. Memory-efficient, good for real-time. Neu-quant: neural network approach. Best quality, slowest.
// Median-cut quantization (simplified)
function medianCut(colors: RGB[], depth: number): RGB[] {
if (depth === 0) return [average(colors)];
const axis = longestAxis(colors); // R, G, or B
colors.sort((a, b) => a[axis] - b[axis]);
const mid = Math.floor(colors.length / 2);
return [
...medianCut(colors.slice(0, mid), depth - 1),
...medianCut(colors.slice(mid), depth - 1),
];
}The Aesthetic Power of Constraint
Combined with dithering, quantization becomes a powerful aesthetic tool. The restricted palette creates a distinctive retro look — evoking CGA, EGA, and Game Boy eras — while dithering recovers the illusion of smooth gradients. The tension between limited means and rich results is central to the BVDART aesthetic.
For best results, quantize in a perceptually uniform color space like OKLCH rather than RGB. This ensures the selected palette colors are maximally distinguishable to the human eye.
Articles
Related artworks
Related Lab categories
Sources & references
Guide updated
