[][src]Function photon_rs::channels::selective_saturate

pub fn selective_saturate(img: &mut PhotonImage, ref_color: Rgb, amt: f32)

Selectively saturate pixel colours which are similar to the reference colour provided.

Similarity between two colours is calculated via the CIE76 formula. Only saturates the hue of a pixel if its similarity to the reference colour is within the range in the algorithm. For example, if a user wishes all pixels that are blue to have an increase in saturation by 10%, they can selectively specify only the blue pixels to be changed.

Arguments

  • img - A PhotonImage.
  • ref_color - The RGB value of the reference color (to be compared to)
  • amt - The amount of saturate the colour by.

Example

// For example, to only increase the saturation of pixels that are similar to the RGB value RGB{20, 40, 60}:
let ref_color = Rgb{20, 40, 60};
photon::channels::selective_saturate(&mut img, ref_color, 0.1);