Skip to main content

load_with_maxcolor

Function load_with_maxcolor 

Source
pub fn load_with_maxcolor<P>(
    path: P,
    max_color: u8,
) -> Result<(Vec<Record>, u32, u32), ImageError>
where P: AsRef<Path>,
Expand description

Open the image located at the path specified, return {max_color} dominant colors.

ยงExamples

let (colors, width, height) = image_palette::load_with_maxcolor("test.jpg", 8).unwrap();
println!("total: {}", width * height);
for color in colors {
  println!("{}: {}", color.rgb().to_hex(), color.count());
}