#color #image #extractor #external #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

#368 in Images

Download history 1686/week @ 2024-07-19 2976/week @ 2024-07-26 1522/week @ 2024-08-02 1587/week @ 2024-08-09 1543/week @ 2024-08-16 2076/week @ 2024-08-23 1659/week @ 2024-08-30 1451/week @ 2024-09-06 1956/week @ 2024-09-13 1164/week @ 2024-09-20 1769/week @ 2024-09-27 1127/week @ 2024-10-04 417/week @ 2024-10-11 299/week @ 2024-10-18 444/week @ 2024-10-25 363/week @ 2024-11-01

1,603 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