Blue Noise
A Rust library and CLI for generating blue noise textures and dithering images using the void-and-cluster algorithm.
Installation
Or build from source:
Usage
Generate a texture
Options:
--size- Texture size in pixels (default: 128)--width- Texture width in pixels (overrides--size)--height- Texture height in pixels (overrides--size)--output- Output file path--sigma- Gaussian sigma, 1.0-3.0 (default: 1.9)--seed- Random seed for reproducibility--verbose- Show progress
Dither an image
Options:
--input- Input image--output- Output image--noise- Blue noise texture (default: blue-noise.png)--foreground- Foreground color as hex (default: #000000)--background- Background color as hex (default: #ffffff)--width- Output width--height- Output height--contrast- Contrast adjustment (default: 1.0)
Library
Add to your Cargo.toml:
[]
= "0.2"
Generate a texture:
use ;
let config = BlueNoiseConfig ;
let generator = new?;
let result = generator.generate?;
save_blue_noise_to_png?;
Apply dithering:
use ;
let noise = load?;
let options = DitherOptions ;
apply_dithering?;
Examples


References
- Ulichney, R. (1993). "Void-and-cluster method for dither array generation"
- Ulichney, R. (1988). "Dithering with blue noise"
License
MIT