How 5-Bit RGB Quantized Bucketing & Distance Filtering Prevent Duplicate Swatches
Inside the algorithm that avoids outputting six near-identical shades of sky blue from one image.
Primary Browser Tool
Image Palette Extractor
Extract up to 12 dominant colors from any photograph or illustration and export ready-to-paste CSS custom properties.
Grouping & Euclidean RGB Diversity Filtering
Counting raw 24-bit RGB frequencies on a sunny sky photo would return `#3B82F6`, `#3B83F6`, and `#3A82F5` as the top three colors. RapidPNG groups pixels into 5-bit per channel frequency buckets (`32 × 32 × 32`), averages actual RGB values inside each bin, and enforces a minimum squared Euclidean distance (`Δr² + Δg² + Δb² >= 1600`) so every returned swatch represents a distinct visual tone.
Practical Examples
Separating Warm Sunset Highlight from Deep Silhouette
Distance filtering skips minor sky gradients so the deep foreground shadow and bright amber accent both appear in a 6-color palette.
Common Mistakes & Honest Limitations
Mistakes to Avoid
- Expecting tiny 10px bright red accents inside a huge green forest photo to dominate raw area frequency.
Technical Limitations
- Small accent highlights occupying under ~1% of pixels are easier to sample manually in Image Color Picker.