PImage img, img2, img3, img4; void setup() { size(530, 363); // load images // 1st img = loadImage("logo.png"); image(img, 10, 10); // 2nd img2 = img.get(); image(img2, 2*10+1*img.width, 10); // 3rd img3 = img.get(); image(img3, 1*10, 2*10+img.height); // 4rd img4 = img.get(); image(img4, 2*10+1*img.width, 2*10+img.height); noLoop(); } void draw() { // colourize 1st pic color co1; color cn1 = color(random(255),random(255),random(255)); co1 = get(10,10); for(int x=10; x<260; x = x + 1) { for(int y=10; y<177; y = y + 1) { if (get(x,y) == co1) { set(x,y, cn1); } else { set(x, y, color(255-red(cn1), 255-green(cn1), 255-blue(cn1))); } } } // colourize 2nd pic color co2; color cn2 = color(random(255),random(255),random(255)); co2 = get(2*10+img.width,10); for(int x=2*10+img.width; x<520; x = x + 1) { for(int y=10; y<177; y = y + 1) { if (get(x,y) == co2) { set(x,y, cn2); } else { set(x, y, color(255-red(cn2), 255-green(cn2), 255-blue(cn2))); } } } // colourize 3rd pic color co3; color cn3 = color(random(255),random(255),random(255)); co3 = get(10, 2*10+img.height); for(int x=10; x<260; x = x + 1) { for(int y=2*10+img.height; y<354; y = y + 1) { if (get(x,y) == co3) { set(x,y, cn3); } else { set(x, y, color(255-red(cn3), 255-green(cn3), 255-blue(cn3))); } } } // colourize 4rd pic color co4; color cn4 = color(random(255),random(255),random(255)); co4 = get(2*10+img.width, 2*10+img.height); for(int x=2*10+img.width; x<520; x = x + 1) { for(int y=2*10+img.height; y<354; y = y + 1) { if (get(x,y) == co4) { set(x,y, cn4); } else { set(x, y, color(255-red(cn4), 255-green(cn4), 255-blue(cn4))); } } } } void keyPressed() { if (keyCode == KeyEvent.VK_SPACE) { redraw(); } }