Expand description
A library for fast and high quality image quantization and palette generation.
To get started, see the Pipeline builder struct which serves as the high-level API.
Otherwise, manually compose functions from the other exported modules to suit your needs.
§Features
To reduce dependencies and compile times, quantette has several cargo features
that can be turned off or on:
kmeans: adds an additional high quality quantization method that takes longer to run.threads: exposes parallel versions of most functions viarayon.image: enables integration with theimagecrate.std: use Rust’s standard library (this crate isno_stdcompatible ifthreadsandimageare disabled).
By default, all features are enabled.
All of the color types present in the public API for this crate
(like Srgb or Oklab) are from the palette crate.
You can check it out for more information. For example, its documentation
should provide you everything you need to know to cast
a Vec<Srgb<u8>> into a Vec<[u8; 3]> or vice versa.
Modules§
- color_
map - Map the colors of an image to a color palette or to palette indices.
- color_
space - Efficient color space conversion.
- dedup
- Functions to deduplicate pixels into a
Vec,PaletteCounts,IndexedImage, orIndexedImageCounts. - deps
- Re-exports of third party crates whose types are present in
quantette’s public API. - dither
- Dithering implementations.
- kmeans
- Color quantization by k-means clustering.
- wu
- Wu’s color quantization method (Greedy Orthogonal Bipartitioning).
Structs§
- Create
Image BufError - The error returned when an
Imagefailed to be created. Includes the pixel buffer used to try and create the image. - Create
Image Error - The error returned when an
Imagefailed to be created. - Create
Indexed Image Error - The error returned when an
IndexedImagefailed to be created. - Create
Palette BufError - The error returned when an
PaletteBuffailed to be created. - Create
Palette Counts Error - The error returned when a
PaletteCountsfailed to be created. - Image
- The base image type parameterized by the type of the container.
- Indexed
Image - An image represented as a palette of colors and a series of indices into that palette.
- Indexed
Image Counts - An image represented as a palette of colors and a series of indices into that palette. This type also stores the number of times each palette color is referenced.
- Length
OutOf Range - The error returned when the length of a value or input is not in the supported range.
- Palette
- A
Paletteis a slice with a length in the range1..=256specified byPalette::MIN_LENandPalette::MAX_LEN. - Palette
Buf - A
PaletteBufis an ownedPalette. - Palette
Counts - A palette of colors and their corresponding counts.
- Palette
Size - This type is used to specify the number of colors in a palette.
- Palette
Size From IntError - The error returned when attempting to convert an out of range integer into a
PaletteSize. - Pipeline
- A builder struct to specify image quantization options.
- Pipeline
With Image RefInput - A
Pipelinepaired with some image, ready to be quantized or computed into a palette. - Pipeline
With Slice Input - A
Pipelinepaired with some slice of pixels, ready to be computed into a palette.
Enums§
- Create
Palette Counts Error Reason - The reason a
PaletteCountsfailed to be created. - Palette
InColor Space - A
PaletteBufof colors in one of the supported color spaces forQuantizeMethod::CustomPalette. - Quantize
Method - The set of supported color quantization methods.
Constants§
- MAX_
PIXELS - The maximum amount of pixels supported by this library (
u32::MAX).
Traits§
- Bounded
Index - A trait for unsigned integer types that can be used as indices.
- Color
Components - Types that may be cast to and from a fixed sized array.