Advertisement
xeromino

pic

Nov 19th, 2014
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. PImage img;
  2. int sc = 7; //scale factor
  3.  
  4. void setup() {
  5. img = loadImage("1.jpg");
  6. size(1200, 800);
  7. doStuff();
  8. }
  9.  
  10. void draw() {
  11. }
  12.  
  13. void mouseClicked() {
  14. doStuff();
  15. }
  16.  
  17. void keyPressed() {
  18. save(random(100)+".jpg");
  19. }
  20.  
  21. void doStuff() {
  22. background(255);
  23. int w = img.width/sc;
  24. int h = img.height/sc;
  25. for (int x=int (w*.1); x<width-w; x += int (w*1.1)) {
  26. for (int y=int (h*.1); y<height-h; y += int (h*1.1)) {
  27. PImage temp = createImage(w, h, RGB);
  28. temp.copy(img, 0, 0, img.width, img.height, 0, 0, w, h);
  29. tint(255, random(50, 256));
  30. image(temp, x, y);
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement