[][src]Function photon_rs::multiple::replace_background

pub fn replace_background(
    photon_image: &mut PhotonImage,
    img2: &PhotonImage,
    background_color: Rgb
)

Change the background of an image (using a green screen/color screen).

Arguments

  • img - A PhotonImage which contains the desired background. Must be the same size as img2.
  • img2 - The image you would like to swap the background of. Must be the same size as img.
  • background_color - The RGB value of the background, which should be replaced.

Example

// For example, to replace the background of ImageA (which is RGB value 20, 40, 60) with the background of ImageB:
use photon::multiple;
let rgb = Rgb{20, 40, 60};
photon::multiple::replace_background(img_b, img_a, rgb);