code: function recolorBillboard(img, color) {
    var canvas = document.createElement("canvas");
    canvas.width = img.width;
    canvas.height = img.height;
  
    // Copy the image contents to the canvas
    var context = canvas.getContext("2d");
    context.drawImage(img, 0, 0);
    var image = context.getImageData(0, 0, canvas.width, canvas.height);
    var normClr = [color.red, color.green, color.blue, color.alpha];
  
    var length = image.data.length; //pixel count * 4
    for (var i = 0; i < length; i += 4) {
      for (var j = 0; j < 4; j++) {
        image.data[j + i] *= normClr[j];
      }
    }
  
    context.putImageData(image, 0, 0);
    return canvas.toDataURL();
    //    return context.getImageData(0, 0, canvas.width, canvas.height);
  }
docs: Recolor an image using 2d canvas