# applyMask method

Image applyMask(

1. Image image,
2. Image mask,
3. int red,
4. int green,
5. int blue

)

Applies a mask to replace the background with the specified color and returns a 24-bit BGR image.

param image Source image to process. param mask Mask to be applied. Must be a 8-bit greyscale image of same size as the input image. param red Green channel of the background color. Must be a value from 0 to 255. param green Red channel of the background color. Must be a value from 0 to 255. param blue Blue channel of the background color. Must be a value from 0 to 255. return The output image. throws FaceException An error has occurred during Face Library execution.

## Implementation

    Image applyMask(Image image, Image mask, int red, int green, int blue) {
      Image segmentedFace = Image();
      var err = faceSDK.id3FaceAnalyser_ApplyMask(_pHandle.value, image.handle, mask.handle, red, green, blue, segmentedFace.handle);
      if (err != FaceError.success.value) {
        segmentedFace.dispose();
        throw FaceException(err);
      }
      return segmentedFace;
    }