#palette-generation

dominant_color

Simple image color extractor written in Rust with no external dependencies

10 releases

0.4.0 Mar 6, 2023
0.3.0 Feb 22, 2020
0.2.4 Feb 19, 2020
0.2.2 Jun 29, 2019
0.1.2 Jun 29, 2019

#353 in Images

Download history 1342/week @ 2024-06-13 1313/week @ 2024-06-20 1112/week @ 2024-06-27 1359/week @ 2024-07-04 1574/week @ 2024-07-11 1755/week @ 2024-07-18 2889/week @ 2024-07-25 1523/week @ 2024-08-01 1245/week @ 2024-08-08 1936/week @ 2024-08-15 2006/week @ 2024-08-22 1849/week @ 2024-08-29 1180/week @ 2024-09-05 2235/week @ 2024-09-12 1154/week @ 2024-09-19 1585/week @ 2024-09-26

6,447 downloads per month
Used in 2 crates

MIT license

120KB
74 lines

Simple image color extractor written in Rust with no external dependencies

Demo:

https://dominant-color-demo.marekm4.com/

Blog post:

https://medium.com/@marek.michalik/c-vs-rust-vs-go-performance-analysis-945ab749056c

Usage:

use std::path;

fn main() {
    let image = image::open(path::Path::new("docs/Fotolia_45549559_320_480.jpg")).unwrap();
    let colors = dominant_color::get_colors(image.to_rgb8().into_raw().as_slice(), false);
    println!("colors: {:?}", colors);
}

Example image:

Image

Extracted colors:

Colors

No runtime deps