Struct exoquant::Histogram [] [src]

pub struct Histogram { /* fields omitted */ }

A histogram that counts the number of times each color occurs in the input image data.

The Histogram is used to describe the color distribution of the input image to the quantization process. Histogram implements both Extend<Color> and FromIterator<Color>, so you can either create an empty instance using Histogram::new() and fill it width histogram.extend(iter), or just create from an Iterator<Color> using iter.collect().

The Histogram::new(), histogram.extend(...) method is useful when you want to create one palette for multiple distinct images, multiple frames of a GIF animation, etc.

Examples

let mut histogram = Histogram::new();
histogram.extend(image.pixels.iter().cloned());
let histogram: Histogram = image.pixels.iter().cloned().collect();

Methods

impl Histogram
[src]

Returns a new, empty Histogram.

Converts the rgba8 Histogram to a Vec of ColorCount in quantization color space.

Mostly used internally.

Returns an iterator over the histogram data.

Trait Implementations

impl Extend<Color> for Histogram
[src]

Extends a collection with the contents of an iterator. Read more

impl FromIterator<Color> for Histogram
[src]

Creates a value from an iterator. Read more