diff --git a/PROCESSING 3/pixeldrifter/pixeldrifter.pde b/PROCESSING 3/pixeldrifter/pixeldrifter.pde new file mode 100644 index 0000000..0d23343 --- /dev/null +++ b/PROCESSING 3/pixeldrifter/pixeldrifter.pde @@ -0,0 +1,149 @@ +// Drift pixels and blend, repeat +// Tomasz Sulej, generateme.blog@gmail.com, http://generateme.tumblr.com +// Licence: http://unlicense.org/ + +// Usage: +// * press SPACE to save + +// set up filename +String filename = "test"; +String fileext = ".jpg"; +String foldername = "./"; + +int max_display_size = 800; // viewing window size (regardless image size) + +// config +int channel = HUE; // channel data used for shift +float channel_off = 60; // channel value offset +int iteration_no = 50; // number of iterations 10-100 +int direction = UP; // UP, DOWN, LEFT, RIGHT +boolean image_mix = false; // mix with original image or current buffer +boolean automate_channel_offset = false; // if true, change channel_offset every iteration +float scale = 0.03; // 0.01 - 0.1, step size (0.01: 2px, 0.1:25px) +float feedback = 0.9; // 0.9 - 0.999 ; blend ratio with original image + +boolean do_blend = false; // blend image after process +int blend_mode = OVERLAY; // blend type + +// working buffer +PGraphics buffer; + +// image +PImage img, imgb; + +String sessionid; +float acho_step; + +void setup() { + sessionid = hex((int)random(0xffff),4); + img = loadImage(foldername+filename+fileext); + imgb = img.get(); + + buffer = createGraphics(img.width, img.height); + buffer.beginDraw(); + buffer.noStroke(); + buffer.smooth(8); + buffer.background(0); + buffer.image(img,0,0); + buffer.endDraw(); + + // calculate window size + float ratio = (float)img.width/(float)img.height; + int neww, newh; + if(ratio < 1.0) { + neww = (int)(max_display_size * ratio); + newh = max_display_size; + } else { + neww = max_display_size; + newh = (int)(max_display_size / ratio); + } + + surface.setResizable(true); + surface.setSize(neww, newh); + + scale = abs(scale); + acho_step = 256.0 / iteration_no; + println(acho_step); +} + +void draw() { + if(iteration_no>0) { + processImage(); + iteration_no--; + println("steps left: "+iteration_no); + } else { + if(do_blend) { + buffer.beginDraw(); + buffer.blend(img,0,0,img.width,img.height,0,0,buffer.width,buffer.height,blend_mode); + buffer.endDraw(); + } + image(buffer,0,0,width,height); + noLoop(); + } +} + +void processImage() { + buffer.beginDraw(); + + for(int x=0;x5?channel-6:channel; + float cc; + + switch(ch) { + case RED: cc = red(c); break; + case GREEN: cc = green(c); break; + case BLUE: cc = blue(c); break; + case HUE: cc = hue(c); break; + case SATURATION: cc = saturation(c); break; + default: cc= brightness(c); break; + } + + return channel>5?255-cc:cc; +} diff --git a/PROCESSING 3/pixeldrifter/test.jpg b/PROCESSING 3/pixeldrifter/test.jpg new file mode 100755 index 0000000..b8a528e Binary files /dev/null and b/PROCESSING 3/pixeldrifter/test.jpg differ diff --git a/PROCESSING 3/pixeldrifter/test/res_3DFBDFBD_test.jpg b/PROCESSING 3/pixeldrifter/test/res_3DFBDFBD_test.jpg new file mode 100755 index 0000000..65ed396 Binary files /dev/null and b/PROCESSING 3/pixeldrifter/test/res_3DFBDFBD_test.jpg differ diff --git a/PROCESSING 3/pixeldrifter/test/res_6E03D9C8_test.jpg b/PROCESSING 3/pixeldrifter/test/res_6E03D9C8_test.jpg new file mode 100755 index 0000000..0f2e428 Binary files /dev/null and b/PROCESSING 3/pixeldrifter/test/res_6E03D9C8_test.jpg differ diff --git a/PROCESSING 3/pixeldrifter/test/res_C46F2C23_test.jpg b/PROCESSING 3/pixeldrifter/test/res_C46F2C23_test.jpg new file mode 100755 index 0000000..65f2b9a Binary files /dev/null and b/PROCESSING 3/pixeldrifter/test/res_C46F2C23_test.jpg differ diff --git a/PROCESSING 3/pixeldrifter/test/res_FF2FD95F_test.jpg b/PROCESSING 3/pixeldrifter/test/res_FF2FD95F_test.jpg new file mode 100755 index 0000000..108ceba Binary files /dev/null and b/PROCESSING 3/pixeldrifter/test/res_FF2FD95F_test.jpg differ