Photo Art in Tableau

Do you know what pointillism is? It’s a technique of painting with small distinct dots to create an image. And you can do this with Tableau! Well, sort of.
I made this series of pointillistic representations of well known photographs and paintings for Tableau’s Viz As Art contest. Be sure to click on the “photoart” tab to view my collection of 10 images, as well at the “revolution” tab.

I used Processing to extract each pixel’s coordinate and colour value, convert RGB colour values to greyscale and output the table to a text file. The Processing code is listed below. Note that I am yet to find a way to properly highlight Processing syntax in WordPress, let me know if you use a plugin that understands Processing. If you are wondering about the RGB to grayscale conversion step, read this Wikipedia article.

PImage photo;
PrintWriter textFile;
//enter name of file you want to process (no extension)
String file = "Obama";

void setup() {
  //load image
 photo = loadImage(file + ".png");
  //initialize output text file
 textFile = createWriter("txtfiles/" + file + ".txt");
    for (int column = 0; column < photo.width; column++) {
      for (int row = 0; row < photo.height; row++) {
      //extract pixel's colour value
      color c = photo.pixels[row*photo.width+column];
 //convert RGB values to grayscale
      int g = round(red(c)*0.2126+green(c)*0.7152+blue(c)*0.0722);
 //print output to console (optional)
 println(column + "," + row + "," + g);
 //save output to text file
      textFile.println(column + "," + row + "," + g);

I imported the resulting text files to Tableau and plotted them as scatterplots, varying the symbol Size by the reverse of grayscale values (I wanted larger symbols for darker areas or lower grayscale values). I also binned the grayscale values and applied a 4 colour palette to points.

This technique works best with clean, contrasty images with easily discernible shapes. You may try to experiment with different sizes of original images, but I find that lower resolution gives better results, so before conversion to text I resampled all my source images to 100×100 pixel size. That results in a viz that has abstract quality, as opposed to being a close replication of the original.

Your email is never published or shared. Required fields are marked *



Back to top|Contact me