Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
context.getImageData(0, 0, 100, 100).then(imageData => {
const data = Object.values(imageData.data);
const length = Object.keys(data).length;
for (let i = 0; i < length; i += 4) {
data[i] = 0;
data[i + 1] = 0;
data[i + 2] = 0;
}
const imgData = new ImageData(canvas, data, 100, 100);
context.putImageData(imgData, 0, 0);
});
}