code: def draw_mask_on_image(
      image,
      mask,
      bg_color=(19, 138, 249),
      mask_color=None,
      threshold=125,
      foreground_alpha=None,
      is_0_255=False,
  ):
      """
  
      Draws a mask on top of the original image. This is pretty CPU intensive so may want to revise for production environment
      image and mask must be the same size!
  
      :param image: numpy array of the image [Width, Height, RGB]
      :param mask: numpy array representing b/w image mask (black pixels - mask, white pixels - background)
      :param bg_color: numpy tuple (R,G,B) desired color to fill background with (default: magenta)
      :param mask_color: numpy array [R,G,B] desired color to colorize the extracted pixels with (default: yellow)
      :param threshold: threshold value used to determine which pixels in the mask to keep (default: >= 125)
      :param foreground_alpha: the proportions of blending between the pixels from the image and from mask_color (default: [1.0, 1.0, 0.5] of image mixed with 1-foreground_alpha of mask_color)
      :param is_0_255: whether the image and mask are in 0-1 floating range or 0-255 integer range (default: False)
  
      :return: numpy array containing composite image [RGB]
  
      """
      if mask_color is None:
          mask_color = [255, 255, 0]
      if foreground_alpha is None:
          foreground_alpha = [1.0, 1.0, 0.5]
      if not is_0_255:
          image = image * 255
          mask = mask * 255
  
      mask = (
          mask > threshold
      )  # make sure all values below threshold are zero!
  
      H, W, _ = image.shape
  
      if (H, W) != mask.shape:
          raise AssertionError("image size does not equal mask size!")
  
      results = np.zeros(
          (H, W, 3), np.uint8
      )  # create new image and fill with zeros
      results[
          ...
      ] = bg_color  # fill entire image with bg_color at first
  
      for x in range(
          W
      ):  # iterate over every pixel and calculate new values
          for y in range(H):
              if mask[x][y] > 0:
                  results[x][y][0] = (
                      image[x][y][0] * foreground_alpha[0]
                  ) + (mask_color[0] * (1.0 - foreground_alpha[0]))
                  results[x][y][1] = (
                      image[x][y][1] * foreground_alpha[1]
                  ) + (mask_color[1] * (1.0 - foreground_alpha[1]))
                  results[x][y][2] = (
                      image[x][y][2] * foreground_alpha[2]
                  ) + (mask_color[2] * (1.0 - foreground_alpha[2]))
  
      return results
  
label_desc: Use image node_id 2 for calling a global function with example usage: draw_mask_on_image(image, mask, bg_color, mask_color, threshold, foreground_alpha, is_0_255) and returns: results