how to get the data from canvas using JS code example Example: getImageData() ctx.getImageData(sx, sy, sw, sh);