code: function recolorImageWithCanvasContext(context, img, colorFunc) {
    if (!defined(context)) {
      throw new DeveloperError("No context for image recoloring.");
    }
  
    // Copy the image contents to the canvas
    context.clearRect(0, 0, context.canvas.width, context.canvas.height);
    context.drawImage(img, 0, 0);
    var image = context.getImageData(
      0,
      0,
      context.canvas.width,
      context.canvas.height
    );
    image = ImageryProviderHooks.recolorImage(image, colorFunc);
    return image;
  }
docs: /* Copy an image to a newly created Canvas, then perform recoloring there.