PImage pic; int[] pixelArray; boolean useMouse; boolean mouseDown; int boxWidth; int boxHeight; void setup() { size(600,400); frameRate(10); colorMode(HSB,255); background(0); smooth(); //amelie.jpg, cac.jpg, food.jpg, night.jpg, lime.jpg, toronto.jpg pic = loadImage("src/amelie.jpg"); useMouse = true; mouseDown = false; boxWidth = 100; boxHeight = 100; } void draw() { //turn on of off if (mousePressed) { if (mouseDown == false) { mouseDown = true; useMouse = !useMouse; } }else{ mouseDown = false; } makeImage(); //save image if (keyPressed) { if (key == 'S' || key == 's') { //String time = "savedImages/savedimage-"+month()+day()+year()+"_"+hour()+minute()+second()+"_"+millis()+".png"; //save(time); } if (keyCode == RIGHT) { boxWidth += 10; } if (keyCode == LEFT) { boxWidth -= 10; } if (keyCode == UP) { boxHeight += 10; } if (keyCode == DOWN) { boxHeight -= 10; } } } void makeImage() { background(0); int x; int y; if (useMouse == true) { x = round(mouseX); y = round(mouseY); }else{ x = round(random(0,width)); y = round(random(0,height)); } color pix = pic.get(x,y); int count = 0; //loop thought image pixels: int leftBound = x - boxWidth/2; if (leftBound < 0) { leftBound = 0; } int rightBound = x + boxWidth/2; if (rightBound > width) { rightBound = width; } int topBound = y - boxHeight/2; if (topBound < 0) { topBound = 0; } int bottomBound = y + boxHeight/2; if (bottomBound > height) { bottomBound = height; } stroke(0,255,255,255); rect(leftBound,topBound,boxWidth,boxHeight); stroke(pix); for (int w=leftBound; w