Crates.io | color_quant |
lib.rs | color_quant |
version | 1.1.0 |
source | src |
created_at | 2015-05-29 12:14:41.495169 |
updated_at | 2020-10-09 19:17:17.742242 |
description | Color quantization library to reduce n colors to 256 colors. |
homepage | |
repository | https://github.com/image-rs/color_quant.git |
max_upload_size | |
id | 2251 |
size | 21,282 |
This library provides a color quantizer based on the NEUQUANT quantization algorithm by Anthony Dekker.
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();