Powered By Blogger

Monday 21 March 2011

Final Wallpaper Three

Here I have used rectangles to explore an image and the colour within that image (below).

Again the wallpaper has only taken a section of the image to draw from resulting in the distribution of colours being different to the original image itself.













The code below is again similar to the previous codes, but with the change in image and shapes being drawn, the result is rather unique.


import processing.pdf.*;




PImage img;
float cameraX,cameraY;

void setup(){
  size(500,1000,P2D);
  img = loadImage("http://www.testq.com/nfs/testq/photos/0000/6021/landscape.jpg"); //Different Image


  beginRecord(PDF, "wallpaper_1.pdf"); 
  background(0);
   
}


void draw (){


  camera(-100, 50, random(-500,800), width, height, 1, 1, 1, 1);

  println(cos(cameraX));
    
  int x=floor(random(0,img.width));
  int y= floor(random(0,img.height));
    
  color myColor = img.get(x,y);
    
  noStroke(); //No outline for a smoother transition between colours.
  fill(myColor,50); //Transparency of 50 to create a clearly defined rectangle, however still allowing for build up.
  rect(x,y,random(10,450),random(10,80)); //Rectangle shape being drawn to the values of the image and within a certain dimension so as to make sure there are no huge rectangle being drawn and keeping with a largely horizontal sketched view.



}
  
void keyPressed(){
  endRecord();
}


Here is the final result:

No comments:

Post a Comment