var canvas = document.getElementById('master');
var ctx = canvas.getContext('2d');
var pid = document.getElementById('pid').getContext('2d');
var pid2 = document.getElementById('pid2').getContext('2d');
var imgData;
var width = 1000;
var height = 1000;
ctx.width = width;
ctx.height = height;
ctx.fillStyle = "red";
for (let i=0; i<width; i+=50) {
ctx.fillRect(i,0,50,50);
ctx.fillRect(i,(height/2)-25,50,50);
ctx.fillRect(i,height-50,50,50);
}
for (let i=0; i<height; i+=50) {
ctx.fillRect(0,i,50,50);
ctx.fillRect((width/2)-25,i,50,50);
ctx.fillRect(width-50,i,50,50);
}
imgData = ctx.getImageData(0,0,width,height);