Script Part IV

This entry is dealing with some experiments based on the additional material from the script and more specifically with images made of text.

Created this by accident

Working with text

void setup() {
  size(500, 500);
  background(255);
  PImage img = loadImage("corona.png");
  //image(img, 0, 0);

  for (int y=0; y<height; y=y+10) {
    for (int x=0; x<width; x=x+10) {
      char c = 'c';
      color col = img.get(x, y);
      fill(col);
      text(c, x, y);
    }
  }
}

Corona comes and goes

PFont f; // STEP 1 Declare PFont variable

void setup() {
  size(500, 500);
  background(255);
  f = createFont("PTMono-Bold", 16, true); // STEP 2 Create Font
  PImage img = loadImage("corona.png");
  String theText="Corona comes and goes. ";
  int i=0; 
  for (int y=0; y<height; y=y+10) {
    for (int x=0; x<width; x=x+10) {
      char c = theText.charAt(i);
      color col = img.get(x, y);
      fill(col);
      textFont(f, 8); 
      text(c, x, y);
      i=i+1;
      if (i>theText.length()-1) {
        i=0;
      }
    }
  }
}
PFont f; // STEP 1 Declare PFont variable

void setup() {
  size(500, 500);
  background(0);
  f = createFont("PTMono-Bold", 8, true); // STEP 2 Create Font
  PImage img = loadImage("corona.png");
  String theText="Corona comes and goes. ";
  int i=0; 
  for (int y=0; y<height; y=y+10) {
    for (int x=0; x<width; x=x+10) {
      char c = theText.charAt(i);
      color col = img.get(x, y);
      fill(col);
      textFont(f, 15); 
      text(c, x, y);
      i=i+1;
      if (i>theText.length()-1) {
        i=0;
      }
    }
  }
}

I added a background to the image and increased the saturation in photoshop. I probably should have given it a bit more white space around the virus. To fix the spacing, I simply used a proportional font.


Recap

So far the exercise was more or less understandable and I can think of designs where this could be useful.