Thursday, 15 January 2015

javascript canvas putImageData not writing modified data -


I am trying to unbalance an image. I am currently loading it, parsing the image data, but I can not get it back to write in the canvas.

I have followed all directions to

  context.putImageData (imagedata, 0,0);  

I do this, but the image data does not change. The reference to the "CTX" image that was previously loaded, which is being turned on grayscale.

  grayscale: function grayscale (ctx) {var id = ctx.getImageData (0,0, ctx canvas wide, ctx.canvas.height); For (var i = 0; i & lt; id.height; i ++) {for (var e = 0; i  

Instead of internal loop i, you have to compare and increase e.

When you calculate the index, you have the switch between E and I also it should be (with 4 execution):

  var index = 4 * ( I * id.width + e);  

No comments:

Post a Comment