Sarah Kang-Project-09-Computational Portrait

portrait

//sarah kang
//section c
//sarahk1@andrew.cmu.edu
//project-09-computational-portraits

var underlyingImage;

function preload() {
    var myImg = "https://i.imgur.com/kLHusSC.jpg";
    currImage = loadImage(myImg);
}

function setup() {
    createCanvas(244, 480);
    background(0);
    currImage.loadPixels();
    frameRate(100);
}

function draw() {
    var px = random(width);
    var py = random(height);
    var imgW = random(2, 20);
    var imgH = random(2, 20);
    var txtsize = random(1, 10);

    var ix = constrain(floor(px), 0, width-1);
    var iy = constrain(floor(py), 0, height-1);
    var theColorAtLocationXY = currImage.get(ix, iy);

    noStroke();
    fill(theColorAtLocationXY);
    ellipse(px, py, imgW, imgH);

    fill(theColorAtLocationXY);
    textSize(txtsize);
    textFont('Arial');
    text("chicken parm", mouseX, mouseY);

    /*var theColorAtTheMouse = currImage.get(mouseX, mouseY);
    stroke(theColorAtTheMouse);
    line(pmouseX, pmouseY, mouseX, mouseY);*/
}

This was the most recent portrait picture I had on my phone, from when I visited my best friend from home last weekend. I thought the random ellipses made nice compositions and texture with the color areas and palettes in this picture. “chicken parm” is also what we had for breakfast in this picture.

After a few minutes
my best friendd

Leave a Reply