Teachers open the door but You must enter by yourself.
Lij = 0.3 * Rij + 0.59 * Gij + 0.11 * Bij
window.addEventListener('load', function(){
const canvas = document.getElementById('canvas');
canvas.height = canvas.width*1.333;
const context = canvas.getContext('2d');
const image = new Image();
image.src = 'ip/original.jpg';
image.addEventListener("load", function(){
context.drawImage(image,0,0);
const x = context.getImageData(0,0,canvas.width,canvas.height);
for (let i=0; i < x.data.length; i+=4) {
const gray=x.data[i]*0.299+x.data[i+1]*0.587+x.data[i+2]*0.114;
x.data[i]=x.data[i+1]=x.data[i+2]=gray;
}
context.putImageData(x,0,0);
});
});
This site is powered by