pub enum Quantizer {
Naive,
NeuQuant(u32),
}
Expand description
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 Copy for Quantizer
impl Eq for Quantizer
impl StructuralPartialEq for Quantizer
Auto Trait Implementations§
impl Freeze for Quantizer
impl RefUnwindSafe for Quantizer
impl Send for Quantizer
impl Sync for Quantizer
impl Unpin for Quantizer
impl UnwindSafe for Quantizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more