Advertisement
xeromino

Brightsize

Oct 23rd, 2013
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. PImage myImage;
  2. color col;
  3. float sw, br, incr;
  4.  
  5. void setup() {
  6.   background(0);
  7.   colorMode(HSB, 100);
  8.   myImage = loadImage("pal1.gif");
  9.   size(myImage.width, myImage.height);
  10.   myImage.loadPixels();
  11.   incr = 5;
  12. }
  13.  
  14. void draw() {
  15. background(0);
  16.   for (int x = 0;  x<width; x += incr) {
  17.     for (int y = 0; y < height; y += incr) {
  18.       col = myImage.pixels[y*width+x];
  19.       sw = map(brightness(myImage.get(x, y)), 0, 100, 1, 20) ;
  20.       br = brightness(myImage.get(x, y));
  21.       stroke(myImage.get(x, y), 150);
  22.       strokeWeight(sw);
  23.       point(x,y);
  24.     }
  25.   }
  26. }
  27.  
  28. void keyPressed() {
  29.   save(random(123)+".png");
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement