Advertisement
xeromino

scan

Oct 15th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.46 KB | None | 0 0
  1. PImage img;
  2. int edge;
  3.  
  4. void setup() {
  5.   size(540, 540);
  6.   img = loadImage("pic1.jpg");
  7.   edge = width/5;
  8.   rectMode(CENTER);
  9. }
  10.  
  11. void draw() {
  12.   background(20);
  13.   noStroke();
  14.   for (int x=edge; x<width-edge; x++) {
  15.     int y = frameCount%height;
  16.     float br = brightness(img.get(x, y));
  17.     float h = map(br, 0, 255, 0, height/2);
  18.     fill(br);
  19.     rect(x, height/2, 1, h);
  20.   }
  21.   //if (frameCount%2==0 && frameCount<500) saveFrame("image-###.gif");
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement