The Median-Cut Algorithm: How Color Extraction Actually Works
When you upload an image to PDFBucket's Color Palette tool, the algorithm needs to reduce potentially millions of unique pixel colors to a small representative set. It uses median-cut quantization, originally described by Paul Heckbert in 1982.Here is what happens step by step:
- All pixel RGB values are read from the Canvas
- The three color channels (R, G, B) are checked to find which has the largest range
- The pixels are sorted by the widest-range channel and split at the median value โ two groups
- Each group is recursively split again along whichever of its own channels is widest
- After enough splits, you have 8 groups (bins). The average color within each bin becomes the representative color
Why Reference Images Make Great Starting Points for Brand Palettes
Nature and well-composed photography already contain harmonious color relationships. Extracting from a carefully chosen reference image gives you colors that are already balanced against each other, which is harder to achieve by picking colors individually.Practical reference images for brand work:
- Architecture photography โ provides structured neutrals plus occasional accent tones
- Botanical/nature photos โ greens, earth tones, naturalistic palettes
- Fashion photography โ often already curated with brand-appropriate color intent
Copying Colors into Design Tools
Each extracted color swatch shows its hex code in #RRGGBB format. One click copies it to clipboard.- Figma: Press F (fill), then paste the hex code directly
- CSS: Use directly as
color: #4a7c59; - Canva: Custom color picker, paste hex
- Tailwind: Add to your
tailwind.config.jsunderextend.colors