Processing #1

Images made with Processing – creative code. I combined 2 photos in different blend modes and added some  random ‘glitch’ effects overlayed by different patterns.

 

Original photos used:

If you download Processing (v2.0a5) and copy/paste the code beneath and then changing the “baggrund = loadImage(“pete.jpg”);” & “billede = loadImage(“surf1.jpg”);” with images of your own choice (remember to rename the .jpg and change it in the code), then you can play around with different glitch effects. See which keyboard key’s to use at the bottom of the code.
If you have any questions, then please ask – and I will try my best to come up with an answer (still rookie at processing, only done it for a week or so :)).

 

Code:

int filterStyrke = 2;
float minFarveFuckUpFaktor = 0.8;
float maxFarveFuckUpFaktor = 1.3;
int minForskydHoejde = 3;
int maxForskydHoejde = 18;
int minForskydOffset = -20;
int maxForskydOffset = 30;

color[] farve = {
#543040, #8DABF2, #E01150, #FF563D, #27555C
};

color[] farve2 = {
#47A0CC, #BFEFFF, #FFFFFF, #FFE9BF, #BF6060
};

color[] farve3 = {
#78BF82, #A4D17C, #CFD96C, #EBD464, #FFD970
};

int mode =1;
float radius=5;

PImage baggrund;
PImage billede;
void setup() {
baggrund = loadImage(“pete.jpg”);
billede = loadImage(“surf1.jpg”);
size(baggrund.width, baggrund.height);
ellipseMode(CENTER); 
rectMode(CENTER); 
noLoop();
}
void draw() {
image(baggrund, 0, 0);
image(billede, 0, 0);
int effekt = (int) pow(2, (int)random(1, 16)); 
blend(baggrund, 0, 0, 800, 600, 0, 0, 800, 600, effekt); 
for (int i = 0; i < filterStyrke; i++) {
int fraLinje = (int) random(min(width, height));
int antalLinjer = (int) random(min(width, height) – fraLinje);
farveFuckUp(fraLinje, antalLinjer);
forskyd(fraLinje, antalLinjer);
}
if (mode==1) {
for (int x = 0; x < width+100; x += 30) {
for (int y = 0; y < width+100; y += 30) {
fill(farve[(int)random(farve.length)], (int)random(50));
rect (x, y, radius, radius);
fill(farve[(int)random(farve.length)], (int)random(50)); 
noStroke();
}
}
}
else if (mode==2) {
for (int x = 0; x < width+15; x += 20) {
for (int y = 0; y < width+15; y += 20) {
fill(farve2[(int)random(farve2.length)], (int)random(50));
rect (x, y, radius, radius);
fill(farve2[(int)random(farve2.length)], (int)random(50)); 
noStroke();
}
}
}
else if (mode==3) {
for (int x = 0; x < width+20; x += 15) {
for (int y = 0; y < width+20; y += 15) {
fill(farve3[(int)random(farve3.length)], (int)random(50));
rect (x, y, radius, radius);
fill(farve3[(int)random(farve3.length)], (int)random(50)); 
noStroke();
}
}
}
}
void farveFuckUp(int fraLinje, int antalLinjer) {
float roedFaktor = random(minFarveFuckUpFaktor, maxFarveFuckUpFaktor);
float groenFaktor = random(minFarveFuckUpFaktor, maxFarveFuckUpFaktor);
float blaaFaktor = random(minFarveFuckUpFaktor, maxFarveFuckUpFaktor);
int pixelsStart = fraLinje * width;
int pixelsAntal = antalLinjer * width;
loadPixels();
for (int i = pixelsStart; i < pixelsStart + pixelsAntal; i++) {
float roed = red(pixels[i]) * roedFaktor;
float groen = green(pixels[i]) * groenFaktor;
float blaa = blue(pixels[i]) * blaaFaktor;
pixels[i] = color(roed, groen, blaa);
}
updatePixels();
}
void forskyd(int fraLinje, int antalLinjer) {
int hoejde = (int) random(minForskydHoejde, maxForskydHoejde);
for (int i = fraLinje; i < fraLinje + antalLinjer; i += hoejde) {
int offset = (int) random(minForskydOffset, maxForskydOffset);
fill(10, 10, 50);
copy(0, i, width, hoejde, offset, i, width, hoejde);
}
}
void keyPressed() {
if (key == ‘ ‘) redraw();
if (key == ‘1’) mode = 1;
if (key == ‘2’) mode = 2;
if (key == ‘3’) mode = 3;
if (key == ‘r’) radius=random(4, 30);
if (key == ‘s’) save(str(hour()) + str(minute()) + str(second()) + str(millis()) + “.tif”);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s