Function photon_rs::effects::dither

source ·
pub fn dither(photon_image: &mut PhotonImage, depth: u32)
Expand description

Applies Floyd-Steinberg dithering to an image. Only RGB channels are processed, alpha remains unchanged.

Arguments

  • photon_image - A PhotonImage that contains a view into the image.
  • depth - bits per channel. Clamped between 1 and 8.

Example

// For example, to turn an image of type `PhotonImage` into a dithered image:
use photon_rs::effects::dither;
use photon_rs::native::open_image;

let mut img = open_image("img.jpg").expect("File should open");
let depth = 1;
dither(&mut img, depth);