Skip to main content

quantize

Function quantize 

Source
pub fn quantize<C: ColorIndex>(palette: &Palette<C>, color: Rgba) -> C
Expand description

Find the palette entry closest to color.

Distance is summed squared channel difference over all four channels (r, g, b, a), so transparent palette entries only win for transparent input colors. Only the first palette.count entries are considered; ties prefer the lower index.