[][src]Function photon_rs::monochrome::single_channel_grayscale

pub fn single_channel_grayscale(photon_image: &mut PhotonImage, channel: usize)

Convert an image to grayscale by setting a pixel's 3 RGB values to a chosen channel's value.

Arguments

  • photon_image - A PhotonImage.
  • channel - A usize representing the channel from 0 to 2. O represents the Red channel, 1 the Green channel, and 2 the Blue channel.

Example

To grayscale using only values from the Red channel:

monochrome::single_channel_grayscale(&mut img, 0);