palettize 0.2.0

Library for applying ordered Bayer dithering to images with custom color palettes
Documentation
  • Coverage
  • 100%
    31 out of 31 items documented22 out of 24 items with examples
  • Size
  • Source code size: 120.1 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 581.1 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • dp88/palettize
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • dp88

palettize

CI crates.io docs.rs MSRV license

palettize applies ordered Bayer dithering to images using custom color palettes.

Quick start

[dependencies]
image = "0.25"
palettize = "0.2"
use palettize::{dither, grayscale};

let image = image::open("photo.png")?;
let palette = grayscale(6);
let output = dither(&image, &palette);
output.save("photo-dithered.png")?;

# Ok::<(), image::ImageError>(())

Features

  • Generate Bayer matrices from 2×2 through 64×64.
  • Build palettes from RGB colors, hex values, or grayscale stops.
  • Extract palettes with median cut or k-means++ clustering.
  • Remap an image's color distribution onto a palette's distribution in Oklab before dithering.

Requirements

This crate requires Rust 1.85 or later, edition 2024.

More examples and documentation

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.