#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

#4 in Images

Download history 2832/week @ 2018-08-16 3692/week @ 2018-08-23 3981/week @ 2018-08-30 3326/week @ 2018-09-06 4294/week @ 2018-09-13 3540/week @ 2018-09-20 3989/week @ 2018-09-27 4490/week @ 2018-10-04 3889/week @ 2018-10-11 5354/week @ 2018-10-18 4826/week @ 2018-10-25 6374/week @ 2018-11-01 4493/week @ 2018-11-08

13,496 downloads per month
Used in 30 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