You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alternatively eg using getPixels, modifying the array and calling setPixels(modifiedArray)
admittedly this can be done with
var canvas = new CanvasPlus();
// ...
var context = canvas.getContext();
var imageData = context.getImageData(0,0, width, height);
// ...modify imageData
context.putImageData(imageData,0,0);
// this now would also get the modified pixels
var data = canvas.getPixels();
thanks
J.
The text was updated successfully, but these errors were encountered:
Yeah, currently the only way to access the raw pixels is through getPixels(). This will give you a Uint8ClampedArray of RGBA pixels, which you can manipulate. The problem is, you'd then have to use getContext() to put the image data back, using the HTML5 Canvas API.
Sorry there isn't a better API. I'll add this to the TODO list for a future release.
Hi,
I was just looking at the docs and I couldn't see a way to alter the image data? (eg
setPixel(x,y, rgba)
etc)Was wondering if I missed something?
Essentially in one example we want to be able to take a greyscale image, read each pixel's grey level and map it to another 256-colour palette
pseudocode:
alternatively eg using
getPixels
, modifying the array and callingsetPixels(modifiedArray)
admittedly this can be done with
thanks
J.
The text was updated successfully, but these errors were encountered: