[−][src]Function pbnify::quantize::build_palette
pub fn build_palette<I>(n: usize, pixels: I) -> Vec<Rgba<u8>> where
I: IntoIterator<Item = Rgba<u8>>,
Performs the median-cut algorithm, producing an n
-color palette based on the given set of
pixels.
If n
is not a power of two, it will be rounded up to the smallest power of two greater than
n
.
If n
is greater than or equal to the number of given pixels, then the input will be returned
as the result.