Enum engiffen::Quantizer [] [src]

pub enum Quantizer {
    Naive,
    NeuQuant(u32),
}

A color quantizing strategy.

Naive calculates color frequencies, picks the 256 most frequent colors to be the palette, then reassigns the less frequently occuring colors to the closest matching palette color.

NeuQuant uses the NeuQuant algorithm from the color_quant crate. It trains a neural network using a pseudorandom subset of pixels, then assigns each pixel its closest matching color in the palette.

Usage

Pass this as the last argument to engiffen to select the quantizing strategy.

The NeuQuant strategy produces the best looking images. Its interior u32 value reduces the number of pixels that the algorithm uses to train, which can greatly reduce its workload. Specifically, for a value of N, only the pixels on every Nth column of every Nth row are considered, so a value of 1 trains using every pixel, while a value of 2 trains using 1/4 of all pixels.

The Naive strategy is fastest when you know that your input images have a limited color range, but will produce terrible banding otherwise.

Variants

Trait Implementations

impl Debug for Quantizer
[src]

[src]

Formats the value using the given formatter.

impl Eq for Quantizer
[src]

impl PartialEq for Quantizer
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Copy for Quantizer
[src]

impl Clone for Quantizer
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more