Created
February 7, 2011 09:40
-
-
Save ben-biddington/814187 to your computer and use it in GitHub Desktop.
Pointillize with processing.org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PImage img; | |
int iterations = 0; | |
void setup() { | |
img = loadImage("me-small.jpg"); | |
size(img.width,img.height); | |
smooth(); | |
} | |
void draw() { | |
pointillize(16); | |
pointillize(8); | |
pointillize(4); | |
pointillize(1); | |
screenshot(500); | |
} | |
void pointillize(int _size) { | |
int x = int(random(img.width)); | |
int y = int(random(img.height)); | |
int loc = x + y*img.width; | |
int any_pixel = img.pixels[loc]; | |
loadPixels(); | |
float r = red(any_pixel); | |
float g = green(any_pixel); | |
float b = blue(any_pixel); | |
noStroke(); | |
fill(r,g,b,100); | |
ellipse(x,y,_size,_size); | |
} | |
void screenshot(int every) { | |
if (iterations++ % every == 0) { | |
saveFrame("out/" + iterations + ".png"); | |
} | |
} |
And then to make a gif:
$ convert `ls *.png | sort -n` -delay 55 can-you-see-what-it-is-yet.gif
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trim your image to size with ImageMagick: