imageproc::map

Function map_colors_mut

Source
pub fn map_colors_mut<I, P, F>(image: &mut I, f: F)
where I: GenericImage<Pixel = P>, P: Pixel, F: Fn(P) -> P,
Expand description

Applies f to the color of each pixel in the input image in place.

ยงExamples

use image::Luma;
use imageproc::map::map_colors_mut;

let mut image = gray_image!(
    1, 2;
    3, 4);

let want = gray_image!(
    2, 4;
    6, 8);

map_colors_mut(&mut image, |p| Luma([2 * p[0]]));

assert_pixels_eq!(
    image,
    want);