// imagebits // -- does a pointilism thing to the image loaded in // ** window size should be twice the image size // ** window: 200x200 image: 100x100 // // Scott "Jerry" Lawrence // http://www.cis.rit.edu/~jerry/Software/p5 // BImage ji; int ellipseSize = 6; // 6 is the first size ellipse that isn't square! // setup - initialize stuff void setup() { size(200, 200); noBackground(); // persistant background noStroke(); // our ellipses will be solid colored fill(0); rect( 0, 0, width, height ); // clear the screen ellipseMode(CENTER_DIAMETER); // we need to draw ellipses from the center ji = loadImage( "0.jpg" ); // load in our input image (my livejournal icon) } void loop() { for( int a = 0; a < 100 ; a++) { // random coordinate in the image int x = int( random(width) ); int y = int( random(height) ); // snag the source pixel color c = ji.pixels[ (x/2) + ( (y/2) * ji.width ) ]; // set the location in the destination (with an ellipse) fill( c ); ellipse( x, y, ellipseSize, ellipseSize ); } }