Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- int sc = 7; //scale factor
- void setup() {
- img = loadImage("1.jpg");
- size(1200, 800);
- doStuff();
- }
- void draw() {
- }
- void mouseClicked() {
- doStuff();
- }
- void keyPressed() {
- save(random(100)+".jpg");
- }
- void doStuff() {
- background(255);
- int w = img.width/sc;
- int h = img.height/sc;
- for (int x=int (w*.1); x<width-w; x += int (w*1.1)) {
- for (int y=int (h*.1); y<height-h; y += int (h*1.1)) {
- PImage temp = createImage(w, h, RGB);
- temp.copy(img, 0, 0, img.width, img.height, 0, 0, w, h);
- tint(255, random(50, 256));
- image(temp, x, y);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement