Now get rid of the white background of the image using javascript and canvas and make it transparent.
The method below is this but g.putImageData (imgd, 0,0);
(the last line) gives me an error: TypeError: g.putImageData function is not there.
Why is it or is it an easy way to make all the images transparent on my canvas with white background?
var imgd = g.getImageData (leftX, leftY, weight, height), pix = imgd.data, newColor = {r: 0, g: 0, b: 0, a: 0 }; (Var i = 0, n = pix.length; i & lt; n; i + = 4) {var r = pix [i], g = pix [i + 1], b = pix [i + 2]; If (r == 225 & g == 225 & amp; nbsp; B == 225) {pix [i] = newColor.r; Pix [i + 1] = newcolor.g; Pix [i + 2] = new collar.b; Pix [i + 3] = new collar. a; }} G.putImageData (imgd, 0,0);
Comments
Post a Comment