The documented way to do this is to paste the image on a DrawingCanvas, save snapshot and read pixel data from the snapshot. Be aware that the snapshot dimensions may be different from the image dimensions, and if the image is large, this may take a considerable time. It works much faster with scripting, see this demo:
howtoconstructdemos.com/using-flood-fill-for-drawing-canvas-to-make-a-coloring-game
It may be possible to read pixel data directly from the sprite with JavaScript, but I don't know for sure.