int LEVELS = 9; //the possible levels, MUST BE A SQUARE PImage a; //instance of image object void setup(){ a = loadImage("convert.jpg"); //load an image into a size(a.width*int(sqrt(LEVELS)), a.height*int(sqrt(LEVELS))); //set the size of the window based on the size of the image background(255); //white background to start stroke(0); //going to use black to draw //loop through every pixel in the image for(int y=0; ylevel){ i = LEVELS; //break from the loops k = LEVELS; } point(x*sqrt(LEVELS)+k, y*sqrt(LEVELS)+i); //draw a black pixel count++; //increment the var so we know which level we are on } } } } }