#color #colors #quantization #reduce

color_quant

Color quantization library to reduce n colors to 256 colors

2 stable releases

1.0.1 Jun 13, 2018
1.0.0 May 29, 2015

#2 in Images

Download history 3352/week @ 2018-10-11 5354/week @ 2018-10-18 4826/week @ 2018-10-25 6374/week @ 2018-11-01 5461/week @ 2018-11-08 6639/week @ 2018-11-15 5751/week @ 2018-11-22 5050/week @ 2018-11-29 4830/week @ 2018-12-06 6074/week @ 2018-12-13 6562/week @ 2018-12-20 5311/week @ 2018-12-27 4540/week @ 2019-01-03

13,496 downloads per month
Used in 32 crates (5 directly)

MIT license

18KB
306 lines

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();

lib.rs:

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();

No runtime deps