var tome_light1, tome_electric2, tome_water3, tome_heal4, tome_earth5, tome_plant6, tome_fire7, tome_magica8, tome_necro9;
tome_light1 = loadImage("1.png");
tome_electric2 = loadImage("2.png");
tome_water3 = loadImage("3.png");
tome_heal4 = loadImage("4.png");
tome_earth5 = loadImage("5.png");
tome_plant6 = loadImage("6.png");
tome_fire7 = loadImage("7.png");
tome_magica8 = loadImage("8.png");
tome_necro9 = loadImage("9.png");
img = createCapture(VIDEO);
for (var y=0; y<img.height; y+=20)
for (var x=0; x<img.width; x+=20)
var pix = img.pixels[(y*img.width+x)*4];
image(tome_necro9, x, y, 20, 20);
else if (pix > 40 && pix <= 60)
image(tome_magica8, x, y, 20, 20);
else if (pix > 60 && pix <= 80)
image(tome_fire7, x, y, 20, 20);
else if (pix > 80 && pix <= 100)
image(tome_plant6, x, y, 20, 20);
else if (pix > 100 && pix <=120)
image(tome_earth5, x, y, 20, 20);
else if (pix > 120 && pix <=140)
image(tome_heal4, x, y, 20, 20);
else if (pix > 140 && pix <=160)
image(tome_water3, x, y, 20, 20);
else if (pix > 160 && pix <=180)
image(tome_electric2, x, y, 20, 20);
image(tome_light1, x, y, 20, 20);