PROCESSING__ practicing with images (studio VI – pixels)

PIXELS I::

IMAGES::

img006 img022 img034 img055

VIDEO::

CODE::

PImage img1;
PImage img2;

void setup(){
img1 = loadImage(“primera.jpg”);
img2 = loadImage(“segona.JPG”);
size(img1.width,img1.height);
background(255);
}

int n=10;
int loc;
void draw(){

img1.loadPixels();
for(int y=0; y<height; y=y+n){
for(int x=0; x<width;x=x+n ){
loc= x+(y*width);
noStroke();
color c= img1.pixels[loc];
float r= red(c);
float g= green(c);
float b= blue(c);
fill(r,g,b,20);
rect(x+random(-10,10),y+random(-10,10),n,n*0.75);
}
}
imageChanger();

}

void imageChanger(){
if (mousePressed && mouseButton==LEFT || keyPressed){
img1 = loadImage(“segona.JPG”);
}

else{
img1 = loadImage(“primera.jpg”);
}
}

PIXELS II::

IMAGES::

pixels006 pixels035 pixels061 pixels120

VIDEO::

CODE::


PImage img1;
PImage img2;

void setup(){
img1 = loadImage(“primera.jpg”);
img2 = loadImage(“segona.JPG”);
size(img1.width,img1.height);
background(255);
}

int n=50;
int loc;
void draw(){

img1.loadPixels();
for(int y=0; y<height; y=y+n){
for(int x=0; x<width;x=x+n ){
loc= x+(y*width);
noStroke();
color c= img1.pixels[loc];
float r= red(c);
float g= green(c);
float b= blue(c);
fill(r,g,b,20);
rect(x+random(-10,10),y+random(-10,10),n,n*0.75);
}
}
imageChanger();

}

void imageChanger(){
if (mousePressed && mouseButton==LEFT || keyPressed){
img1 = loadImage(“segona.JPG”);
}

else{
img1 = loadImage(“primera.jpg”);
}
}

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