Prototyping Class
September 30, 2021

Me & Molly

The art of posturizing!

The next piece of art made with Processing at our Prototyping Class.

Me & Molly

The code:

PImage art;

// dark  #4D3817
// shadow  #626262
// midtone   #8192BC
// bright   #E8E8E8
color palette[] = {#4D3817, #626262, #F5E8CD, #E8E8E8};
int darklevel = 60;
int shadowlevel = 120;
int midtonelevel = 180;
int highlightlevel = 255;

void setup() {
  noStroke();
 art = loadImage("art.jpg"); 
   println("Bag Image Dimensions");
   println(art.width);
   println(art.height);
   size(600,600);
  
   art.loadPixels();
    for (int j=0; j<art.width; j++) {
      for (int i=0; i<art.height; i++) {
        color c = art.pixels [art.width*i+j];
        float b = brightness(c);
        if ( b >= 0 && b < darklevel) {
          fill ( palette[0] );
          rect (j,i,1,1);
        } else if ( b >= darklevel && b < shadowlevel ) {
          fill ( palette [1] );
          rect (j,i,1,1);
        } else if ( b >= shadowlevel && b < midtonelevel ) {
          fill ( palette [2] );
          rect (j,i,1,1);
        } else if ( b >= midtonelevel && b < highlightlevel ) {
          fill ( palette [3] );
          rect (j,i,1,1);
      }
    }
  }
  textSize(56);
  fill (#4D3817);
  text ("Me & Molly", width/32, height-30);
}