fparkan/vendor/color_quant
Valentin Popov 1b6a04ca55
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
2024-01-08 01:21:28 +04:00
..
src Initial vendor packages 2024-01-08 01:21:28 +04:00
.cargo-checksum.json Initial vendor packages 2024-01-08 01:21:28 +04:00
Cargo.toml Initial vendor packages 2024-01-08 01:21:28 +04:00
CHANGELOG.md Initial vendor packages 2024-01-08 01:21:28 +04:00
LICENSE Initial vendor packages 2024-01-08 01:21:28 +04:00
README.md Initial vendor packages 2024-01-08 01:21:28 +04:00

Color quantization library

This library provides a color quantizer based on the NEUQUANT quantization algorithm by Anthony Dekker.

Usage

let data = vec![0; 40];
let nq = color_quant::NeuQuant::new(10, 256, &data);
let indixes: Vec<u8> = data.chunks(4).map(|pix| nq.index_of(pix) as u8).collect();
let color_map = nq.color_map_rgba();