Skip to content

Instantly share code, notes, and snippets.

@tado tado/drawer.pde
Last active Aug 29, 2015

Embed
What would you like to do?
Drawing photo for processing
PImage img;
void setup() {
size(800, 600);
img = loadImage("photo.jpg");
image(img, 0, 0, width, height);
loadPixels();
background(0);
}
void draw() {
noStroke();
for (int i = 0; i < 100; i++) {
int x = int(random(width));
int y = int(random(height));
color c = pixels[y * width + x];
float h = brightness(c) / 12.0;
float angle = saturation(c) / 80.0;
fill(c, 127);
pushMatrix();
translate(x, y);
rotate(angle);
rect(0, 0, h, 2);
popMatrix();
}
}
@MorimasaAketa

This comment has been minimized.

Copy link

MorimasaAketa commented May 25, 2015

simple and beautiful code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.