PImage img; PImage newImg; int x,y,loc,startPixel; int locPrevious; //Previous location //Pixel neighbors color c, cL, cR, cLdown, cCdown, cRdown, cLup, cCup, cRup; color r = #FF0000; color b = #0000FF; color ye = #FFFF00; int startPixelBrightness = 127; boolean startPixelFound = false; void setup() { size(30,35); img = loadImage("Mississippi River9.png"); newImg = createImage(30,35,RGB); } void draw() { smooth(); newImg.loadPixels(); img.loadPixels(); //MLF: FIX THIS: Not scanning last two columns or rows for (x=0; x startPixelBrightness) { loc = loc - img.width + 1; incrementBrightness(1); } } void rightPixelModifier() { if ((loc + 1) < img.pixels.length) { cR = img.pixels[loc+1]; //color Right if (brightness(cR) > startPixelBrightness) { loc = loc+1; incrementBrightness(2); }} } void lowerRightPixelModifier() { if ((loc + img.width + 1) < img.pixels.length) { cRdown = img.pixels[loc + img.width + 1]; //color Right below if (brightness(cRdown) > startPixelBrightness) { loc = loc + img.width + 1; incrementBrightness(3); }} } void lowerCenterPixelModifier() { if ((loc + img.width) < img.pixels.length) { cCdown = img.pixels[loc + img.width]; //color Center below if (brightness(cCdown) > startPixelBrightness) { loc = loc + img.width; incrementBrightness(4); //newImg.pixels[loc] = color(r); }} } void lowerLeftPixelModifier() { if ((loc + img.width - 1) < img.pixels.length) { cLdown = img.pixels[loc + img.width - 1]; //color Left below if (brightness(cLdown) > startPixelBrightness) { loc = loc + img.width - 1; incrementBrightness(5); }} } void leftPixelModifier() { cL = img.pixels[loc-1]; //color Left if (brightness(cL) > startPixelBrightness) { loc = loc-1; incrementBrightness(6); } } void upperLeftPixelModifier() { cLup = img.pixels[loc - img.width - 1]; //color Left above if (brightness(cLup) > startPixelBrightness) { loc = loc - img.width - 1; incrementBrightness(7); } } void upperCenterPixelModifier() { locPrevious = loc; cCup = img.pixels[loc - img.width]; //color Center above if ((cCup != locPrevious) && (brightness(cCup) > startPixelBrightness)) { //if (brightness(cCup) > startPixelBrightness) { loc = loc - img.width; incrementBrightness(8); //} } } void incrementBrightness(int error_) { //c=c+1; int error = error_; newImg.pixels[loc] = color(brightness(c+1)); c=c+1; println(loc + ": " + error + " (" + brightness(c) + ")"); //println(loc + ": " + error + " (" + locPrevious + ")"); }