Crate quantette

Crate quantette 

Source
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 via rayon.
  • image: enables integration with the image crate.
  • std: use Rust’s standard library (this crate is no_std compatible if threads and image are 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, or IndexedImageCounts.
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§

CreateImageBufError
The error returned when an Image failed to be created. Includes the pixel buffer used to try and create the image.
CreateImageError
The error returned when an Image failed to be created.
CreateIndexedImageError
The error returned when an IndexedImage failed to be created.
CreatePaletteBufError
The error returned when an PaletteBuf failed to be created.
CreatePaletteCountsError
The error returned when a PaletteCounts failed to be created.
Image
The base image type parameterized by the type of the container.
IndexedImage
An image represented as a palette of colors and a series of indices into that palette.
IndexedImageCounts
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.
LengthOutOfRange
The error returned when the length of a value or input is not in the supported range.
Palette
A Palette is a slice with a length in the range 1..=256 specified by Palette::MIN_LEN and Palette::MAX_LEN.
PaletteBuf
A PaletteBuf is an owned Palette.
PaletteCounts
A palette of colors and their corresponding counts.
PaletteSize
This type is used to specify the number of colors in a palette.
PaletteSizeFromIntError
The error returned when attempting to convert an out of range integer into a PaletteSize.
Pipeline
A builder struct to specify image quantization options.
PipelineWithImageRefInput
A Pipeline paired with some image, ready to be quantized or computed into a palette.
PipelineWithSliceInput
A Pipeline paired with some slice of pixels, ready to be computed into a palette.

Enums§

CreatePaletteCountsErrorReason
The reason a PaletteCounts failed to be created.
PaletteInColorSpace
A PaletteBuf of colors in one of the supported color spaces for QuantizeMethod::CustomPalette.
QuantizeMethod
The set of supported color quantization methods.

Constants§

MAX_PIXELS
The maximum amount of pixels supported by this library (u32::MAX).

Traits§

BoundedIndex
A trait for unsigned integer types that can be used as indices.
ColorComponents
Types that may be cast to and from a fixed sized array.

Type Aliases§

ImageBuf
An owned image buffer backed by a Vec.
ImageMut
A mutable, borrowed image backed by a mutable reference to a slice.
ImageRef
A borrowed image backed by a reference to a slice.