#image #quantization #quality #neuquant

color_quant

Color quantization library to reduce n colors to 256 colors

3 stable releases

Uses old Rust 2015

1.1.0 Oct 9, 2020
1.0.1 Jun 13, 2018
1.0.0 May 29, 2015

#1045 in Images

Download history 353285/week @ 2024-12-09 350189/week @ 2024-12-16 160410/week @ 2024-12-23 197773/week @ 2024-12-30 391182/week @ 2025-01-06 450273/week @ 2025-01-13 405287/week @ 2025-01-20 475514/week @ 2025-01-27 529919/week @ 2025-02-03 641917/week @ 2025-02-10 510156/week @ 2025-02-17 557131/week @ 2025-02-24 892698/week @ 2025-03-03 838456/week @ 2025-03-10 1080075/week @ 2025-03-17 1163074/week @ 2025-03-24

4,007,691 downloads per month
Used in 3,404 crates (21 directly)

MIT license

19KB
345 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();

No runtime deps