Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img1, img2, src;
- void setup() {
- img1 = loadImage("raf.jpg");
- img2 = loadImage("rem.jpg");
- size(img1.width, img1.height);
- colorMode(HSB, 255);
- }
- void draw() {
- }
- void mouseReleased() {
- doStuff();
- }
- void keyPressed() {
- save(random(3434)+".jpg");
- }
- void doStuff() {
- int slice=width/5;
- for (int x=0; x<=width; x+=slice) {
- for (int y=0; y<=height; y+=slice) {
- if (random(1)>.5) {
- src=img1;
- copy(src, x, y, slice, slice, x, y, slice, slice);
- } else {
- for (int px=x; px<=x+slice; px++) {
- for (int py=y; py<=y+slice; py++) {
- color col1= img1.get(px, py);
- color col2 =img2.get(px, py);
- float h = hue(col1);
- float s = saturation(col2);
- float b = brightness(col2);
- color col3 = color(h, s, b);
- set(px, py, col3);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement