[][src]Function photon::channels::alter_channel

pub fn alter_channel(img: &mut PhotonImage, channel: usize, amt: i16)

Alter a select channel by incrementing or decrementing its value by a constant.

Arguments

Example

// For example, to increase the Red channel for all pixels by 10:
use photon::channels;
let img = photon::open_image("img.jpg");
photon::channels::alter_channel(&mut img, 0, 10);
// Write the contents of this image in JPG format.
photon::helpers::save_image(img, "new_image.png");

Adds a constant to a select R, G, or B channel's value.

Decrease a channel's value

// For example, to decrease the Green channel for all pixels by 20:

use photon::channels;
photon::channels::alter_channel(&mut img, 1, -20);

Note: Note the use of a minus symbol when decreasing the channel.