It\'s possible to send a CanvasPixelArray obtained via getImageData to a worker script, and let the worker script manipulate the pixels in its back
CanvasPixelArray
getImageData
There's a new API to do this (currently only supported in Firefox if you enable a pref).
See https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas and https://hacks.mozilla.org/2016/01/webgl-off-the-main-thread/.