Project- 09- Portrait

sketchDownload

//Shruti Prasanth
//Project 9- Portrait
//Section C

function preload() {
    var portrait="https://i.imgur.com/CDcRoOA.jpeg"; // image by Aliena85
    photo=loadImage(portrait);    //image variable
}

function setup() {
  createCanvas(300,400);
  background(0);
  photo.resize(300,400);    //resizing the image to fit the canvas
  photo.loadPixels();
  frameRate(10000000000000000000000*100000000000000000);
}

function draw() {
  var x=random(width);
  var y=random(height);
  var pixelx=constrain(floor(x),0,width);
  var pixely=constrain(floor(y),0,height);
  var pixelcolor=photo.get(pixelx,pixely);    //calling each pixel color
  noStroke();
  fill(pixelcolor);    //colors of the squares that appear

  square(x,y,random(0,5));    // squares that form the image


}

My inspiration for this portait was this painting of a girl submitted by Aliena85 on imagur.com. I thought the strokes that created the background and the sunlight filtering through the blinds would be interesting if they appeared in a stippling colored pixel form. It feels magical as the image starts to form because the specs look like colored dust, and gives the portrait of the girl a glowy quality.

Leave a Reply