Dithr: buffer-first halftoning and dithering

Hi all,

I've been working on Dithr, a buffer-first dithering and halftoning library. Dithr is designed around typed mutable slices rather than heavyweight image containers. It implements 35 different halftoning/dithering methods which range from practical methods to some more niche halftoning techniques.


Before (left) and after (right) using yliluoma_2_in_place.

Features:

  • Buffer-first API over explicit width / height / stride image data.
  • Typed Gray / RGB / RGBA support for u8, u16, and f32.
  • Bayer, Floyd-Steinberg, Stucki, Sierra, Atkinson, Yliluoma 1/2/3, Ostromoukhov, Zhou-Fang, Riemersma, Knuth dot diffusion, direct binary search, lattice-Boltzmann, electrostatic halftoning, and more.
  • Palette-constrained and indexed workflows via Palette<S> and IndexedImage<S>.
  • Optional rayon parallel wrappers for selected stochastic, Yliluoma and ordered families.
  • Optional image adapters for DynamicImage-based pipelines.

github: GitHub - pbkx/dithr: Buffer-first rust dithering and halftoning library. · GitHub
crates: crates.io: Rust Package Registry

3 Likes

Have you seen imgref? It offers a similar type to your Buffer (though without as much pixel type detail) and building on it could help interoperability.

3 Likes

buffers in dithr are sample-slice based, not pixel-object based. imgref explicitly assumes one element per pixel