let img;
//my name is an array of letters
let name = ['a', 'l', 'i', 'c', 'e'];
//load image
function preload() {
image = loadImage('http://i.imgur.com/S0F2kRi.jpg');
}
function setup() {
createCanvas(720, 400);
imageMode(CENTER);
noStroke();
background(255);
image.loadPixels();
}
function draw() {
let px = floor(random(image.width));
let py = floor(random(image.height));
let pix = image.get(px, py);
fill(pix, 128);
textSize(20);
textFont("Impact");
//call random letter from name array
text(random(name), py, px);
}
Here is my “pointillism” self-portrait. I wanted to change the points to the letters of my name, so I created an array and called random letters from that array. The letters are called at random coordinates.
//Lauren Park
//Section D
//ljpark@andrew.cmu.edu
//Assignment-09
var selfportrait;
function preload() {
//load image
var imageURL = "https://i.imgur.com/Z0Egws0.jpg";
selfportrait = loadImage(imageURL);
}
function setup() {
createCanvas(480, 480);
background(0);
//load pixels at a rate
frameRate(200);
selfportrait.loadPixels();
}
function draw() {
var px = random(width);
var py = random(height);
var qx = constrain(floor(px), 0, width);
var qy = constrain(floor(py), 0, height);
var colorMylocation = selfportrait.get(qx, qy);
var colorMymouse = selfportrait.get(mouseX, mouseY);
//fill and color pixels with text
strokeWeight(3);
fill(colorMylocation);
text("Lauren", px, py);
//draw and color ellipse at my mouse location
fill(colorMymouse);
noStroke();
ellipse(pmouseX, pmouseY, 8, 8);
}
For this project, I decided to make a computational self-portrait using my name in text to create and color the image. Adding my name I think adds another personal element that goes along with my self-portrait and I also wanted to incorporate using the mouse to load the pixels, using ellipses, in the picture faster.
/* Youie Cho
Section E
minyounc@andrew.cmu.edu
Project-09-Computational-Portrait*/
var myImage;
function preload() {
var myImageURL = "https://i.imgur.com/42viitv.jpg";
myImage = loadImage(myImageURL);
}
function setup() {
createCanvas(500, 500);
background(0);
myImage.loadPixels();
frameRate(2000);
}
function draw() {
var px = random(width);
var py = random(height);
var ix = constrain(floor(px), 0, width-1);
var iy = constrain(floor(py), 0, height-1);
// Color at the current pixel
var theColorAtLocationXY = myImage.get(ix, iy);
// Random sizes of ellipses
var w = random(2, 8);
var h = random(.5, 3);
// Draw ellipses
fill(theColorAtLocationXY);
ellipse(px, py, w, h);
// Use color at the mouse
var theColorAtTheMouse = myImage.get(mouseX, mouseY);
// Draw the dog bone only every 30 frames
if (frameCount % 30 == 0) {
noStroke();
fill(theColorAtTheMouse);
dogBone();
}
}
// Draw dog bone pattern according to mouse movement
function dogBone() {
rectMode(CENTER);
rect(mouseX, mouseY, 20, 8);
ellipse(mouseX - 10, mouseY - 3, 8, 8);
ellipse(mouseX - 10, mouseY + 3, 8, 8);
ellipse(mouseX + 10, mouseY - 3, 8, 8);
ellipse(mouseX + 10, mouseY + 3, 8, 8);
}
This project was fun to make and watch. Figuring out how to differentiate the drawing rate of the particles and my dog bone pattern was interesting, and it would be fun to make use of this in my future projects as well.
//Jina Lee
//jinal2@andrew.cmu.edu
//Section E
//Project-09-Portrait
var myImage;
// preloads photo of my dogs and I
function preload() {
var myImgURL = "https://i.imgur.com/Ux0KKiz.jpg";
myImage = loadImage(myImgURL);
}
function setup() {
createCanvas(640, 480);
background('black');
// the image is too big so have to shrink it to fit canvas
myImage.resize(640, 480);
myImage.loadPixels();
}
function draw() {
// chooses a random x value located near the cursor
var randomX = floor(random(mouseX - 15, mouseX + 15));
// chooses a random y value located near the cursor
var randomY = floor(random(mouseY - 15, mouseY + 15));
// selects the color from a pixel at a random point near the cursor
fill(myImage.get(randomX, randomY));
// draws a circle
dot(randomX, randomY);
}
// creates dot shape
function dot(x, y) {
push();
noStroke();
translate(x, y);
ellipse(0, 2, 5, 5);
pop();
}
For this weeks assignment, I had a lot of fun playing with the image. I used dots to create the photo of my dogs and I when I was younger. It was interesting when I was able to change the circle sizes. I stuck with size 5 because it made the design seem easy to comprehend while also not being extremely clear. I tried size 10 and it seemed too blurry.
//Carly Sacco
//Section C
//csacco@andrew.cmu.edu
//Project 09: Computational Portrait
var myPic; //variable to reference my photo
function preload() {
var origPic = "https://i.imgur.com/B5emP43.jpg"
myPic = loadImage(origPic); //loading the image to the variable
}
function setup() {
createCanvas(360, 480);
myPic.loadPixels();
frameRate(150); //how quickly the arc will be added
}
function draw() {
//these variables link the pixels with the image
var px = random(width);
var py = random(height);
var ix = constrain(floor(px), 0, width-1);
var iy = constrain(floor(py), 0, height-1);
//pixel color from the picture
var pcolor = myPic.get(ix, iy);
noStroke();
fill(pcolor);
//the two separate arcs used added together would be a complete circle
arc(px, py, random(-15, 15), random(-15, 15), HALF_PI, PI);
arc(px, py, random(-15, 15), random(-15, 15), PI, HALF_PI);
//the mouse can be used for more detailed filling in of the image
var mouseColor = myPic.get(mouseX, mouseY);
fill(mouseColor);
ellipse(mouseX, mouseY, 8, 8);
}
After I chose this photo I thought to match the texture of the greenery in the background it would be fun to fill in the image with slightly jagged, but also rounded pieces. I used arc to do this and had two so that added together it would be a complete circle, but since they’re not there was more variation. I did, however make the mouse fill in with circles to get a more accurate filling in for details for the photo.
// Shariq M. Shah
// Project 09
// Section C
var underlyingImage;
function preload() {
//changing example image
var myImageURL = "https://i.imgur.com/hpfafgd.jpg[/img]";
underlyingImage = loadImage(myImageURL);
}
function setup() {
createCanvas(500, 500);
background(0);
underlyingImage.loadPixels();
frameRate(10);
}
function draw() {
var px = random(width);
var py = random(height);
var ix = constrain(floor(px), 0, width-1);
var iy = constrain(floor(py), 0, height-1);
var theColorAtLocationXY = underlyingImage.get(ix, iy);
noStroke();
fill(theColorAtLocationXY);
//making size of "pixels" geometries proportional to distance from CENTER
ellipse(px, py, 0.05 * dist(px, py, width/2, height/2), 0.05 * dist(px, py, width/2, height/2));
var theColorAtTheMouse = underlyingImage.get(mouseX, mouseY);
stroke(theColorAtTheMouse);
noFill();
//drawing ellipses based on mouse location
ellipse(pmouseX, pmouseY, 10, 10);
//placing "mom" text at each ellipse
textSize(0.03 * dist(px, py, width/2, height/2));
text('mom', px, py);
}
In this project, I used a picture of my mom from when we went on a family trip to Chicago this summer. I used small ellipses and text that change in size based on their distance from the center to develop the computational portrait of my mom. In addition, small empty ellipses are drawn with colors of the picture as the user moves the mouse. The drawn ellipses, the “pixel” ellipses, and the text make up the overall computational portrait of my mom. She’ll love seeing this when I go back for Thanksgiving break.
//Zee Salman
//SECTION E
//project 09
var picture;
function preload(){
var url = "https://i.imgur.com/J5xj43q.jpg";
picture = loadImage(url);
}
function setup() {
background(255);
createCanvas(360, 340);
picture.loadPixels();
//rate of the pixels
frameRate(8000);
}
function mouseDragged(){
//size of the brush
var Bmouse = random(11, 30);
//selecting the color
var Dmouse = picture.get(mouseX, mouseY);
//drawing with the mouse dragged
fill(Dmouse);
ellipse(mouseX, mouseY, Bmouse, Bmouse);
}
function draw() {
//random
var x = random(width);
var y = random(height);
//color for pixel
var cx = constrain(floor(x), 0, width - 1);
var cy = constrain(floor(y), 0, height - 1);
var selColor = picture.get(cx, cy);
//color of the circles
noStroke();
fill(selColor);
//more focus on the person
if (x > 60 & x < 200 && y > 0 && y < height){
ellipse(x, y, 5, 5);
}
//closer to the person
else if (x > 20 & x < 300 && y > 0 && y < height){
ellipse(x, y, 7.5, 7.5);
}
//out of focus background
else {
ellipse(x, y, 9, 9);
}
}
I really had fun with this project because I had the opportunity to test out and create different outcomes for different interactions. I also wanted it to still be a picture that has some sort of focus as well, so I created smaller dots/ellipses towards the figure and facial features. But, I still left room for abstraction with the interaction piece making it so that random sized dots create the pictures.
//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.
//Monica Chang
//mjchang@andrew.cmu.edu
//Section D
//Project 09 - Computational Portrait
function preload() {
var myImageURL = "https://i.imgur.com/3WVgXfE.jpg";
itMe = loadImage(myImageURL); //uploading my image
}
function setup() {
createCanvas(360, 480);
background(0);
itMe.loadPixels(); //pixelates the image
frameRate(4000); // rate of generating pixels
}
function draw() {
var px = random(width);
var py = random(height);
var size = random(3, 8);
var offset = 15;
var cx = constrain(floor(px), 0, width-1);
var cy = constrain(floor(py), 0, height-1);
var imgColor = itMe.get(cx, cy);
noStroke();
fill(imgColor);
ellipse(px, py, size);
textSize(size);
textFont("Georgia");
text("M", px + offset, py);
}
I chose to approach this project with a self-portrait.
I think this was one of the easiest but one of the more fun projects we have done this semester. Just like all the other projects, this was very open-ended which allowed me to explore different options comfortably although I struggled to find what else I could do to the image. This also gave me a chance to look at some beautiful photos I had abandoned.
/* Austin Garcia
Section C
aegarcia@andrew.cmu.edu
Assignment or Project
*/
var originalImage;
function preload() {
var myImageURL = "https://i.imgur.com/UdorMH0.jpg";
originalImage = loadImage(myImageURL); //load image
}
function setup() {
createCanvas(500, 500);
background(0);
originalImage.loadPixels();
frameRate(1000);
}
function draw() {
var px = random(width); //x coordinate
var py = random(height); //y coordinate
var ix = constrain(floor(px), 0, width-1);
var iy = constrain(floor(py), 0, height-1);
var locationColor = originalImage.get(ix, iy); //get pixel color
var rectSizeX = random(10, 50)
var rectSizeY = 2
noStroke();
fill(locationColor);
rect(px, py, rectSizeX, rectSizeY);
var theColorAtTheMouse = originalImage.get(mouseX, mouseY);
stroke(theColorAtTheMouse);
ellipse(pmouseX, pmouseY, 1, 2*height + mouseY);
}
I wanted to explore vertical and horizontal lines converging to create this image my girlfriend took of me over the summer. I had the code generate short horizontal bars while having the mouse draw long vertical bars.