Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- void setup() {
- size(100, 100);
- img = loadImage("pic.jpg");
- surface.setResizable(true);
- surface.setSize(img.width, img.height);
- background(255);
- }
- void draw() {
- for (int i=0; i<10; i++) {
- float x = random(width);
- float y = random(height);
- color c = img.get(int(x), int(y));
- float br = brightness(c);
- noStroke();
- fill(br, 150);
- if (random(1)>0.95) {
- if (br > 75) {
- fill(0, 150);
- } else {
- fill(255, 200);
- }
- }
- float sz = map(br, 0, 180, 20, 5)*random(0.5, 1);
- textSize(sz);
- if (br<180) text(char(int(random(97, 122))), x, y);
- }
- }
- void keyPressed() {
- saveFrame("image-###.png");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement