Crates.io | dominant_color |
lib.rs | dominant_color |
version | 0.4.0 |
source | src |
created_at | 2019-06-29 10:15:27.050423 |
updated_at | 2023-03-06 08:16:43.514116 |
description | Simple image color extractor written in Rust with no external dependencies |
homepage | |
repository | https://github.com/marekm4/dominant_color |
max_upload_size | |
id | 144514 |
size | 135,408 |
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:
Extracted colors: