Sometimes, it's nice to create something in Tableau that doesn't necessarily have a practical use. I often find myself thinking, "Would this be possible in Tableau?", and just for the fun of it I'll sometimes try it. One particularly useless question would have been: is it possible to "draw" images and pictures in Tableau? And you've guessed it: it is indeed possible.

After all, to a computer, images and pictures are basically a set of coordinates and a color assigned to it. That is, in a very simplified interpretation. All we'll need to accomplish this challenge is to transform the picture into a set of readable information (coordinates and color) for Tableau. Now, turns out there is a piece of software that does exactly that.

Enter ImageMagick, which is software that allows you to manipulate bitmap images in a lot of different ways. One thing it can also do, is convert an image to a .txt file! If you install ImageMagick, you can easily follow the steps below (or even convert the picture through command line, if you want to do a bunch of them). Animated example below.

  1. Fire up ImageMagick Display (the GUI to the software).
  2. Open an image of your choice, which you wish to "visualize" in Tableau.
  3. Go to "File" > "Save As..."
  4. Save the image as a .txt file by:
    1. Selecting "Save as type": All Files.
    2. Appending ".txt." at the end of the filename in the text box above.
  5. You just converted an image to a text file! Open it to check the contents.

Converting

And this is what this text file looks like, format-wise. You'll find we have the coordinates on the left, and then three different ways of defining the colors for those pixels:

2016-07-13 20_25_19-Wunderlist

Let's import this file in Tableau! We do have a few settings to tweak in our data connection screen before the data is usable:

2016-07-13 20_28_02-Wunderlist

Yeah, that's not exactly what we need... Going through the following steps will help us get the data in the right shape. Again, animated version below.

  1. In the text file connection settings (Text File Properties), set the field separator to Space instead of "#".
  2. Split columns F1 and F4 using Tableau's super-useful "Split" functionality
  3. Rename the newly create columns adequately:
    1. X (the X-coordinate of the point)
    2. Y (the Y-coordinate of the point)
    3. R (the Red color value of the point)
    4. G (the Green color value of the point)
    5. B (the Blue color value of the point)

Data Prep

Once we've done this, we can go to Sheet 1 and start playing! Basically, follow these steps to obtain a (black and white) Tableau-rendered version of your picture! And once more, animation below.

  1. Convert the dimensions X and Y to continuous.
  2. Drag R, G and B to measures to turn them into continuous measures.
  3. Create a calculated field "Negative Y" that contains simply the inverse of Y: 2016-07-13 20_52_26-Cortana
  4. Drag X to the Columns shelf.
  5. Drag Y to the Columns shelf.
  6. Drag any of the color measures (R, G or B) to the Color mark.
  7. That's your picture!! In green, most likely...
  8. To change to grayscale, simply change the settings of the color mark by double clicking the color legend.

Build It

You might notice some weird actions in the recording above. For example, Show Me is being used instead of just dragging and dropping the pills to their appropriate place (Rows, Columns). Similarly a color is being double clicked and sent to the Size mark, then transferred to the Color mark, instead of dragging it there. This is because of a limitation of the screen recording software that was being used, which apparently did not allow drag and drop in Tableau. That's a bit annoying, as 50% of everything one does in Tableau is dragging and dropping stuff... Nevertheless, I think we got a nice example of how all roads lead to Rome, especially in Tableau!

Anyway, you just learned one of the most useless tricks in Tableau, but you can start having a lot of fun by importing all kinds of different pics into Tableau and playing with the color settings! And perhaps you'll end up with a .gif like this, that was created in Tableau!

Results

Author
Timothy Vermeiren

Timothy Vermeiren

Analytics Domain Lead at Biztory, and DataDev Ambassador. Tableau Iron Viz 2018 Global Champion, Tableau Ambassador 2020-2021, Tableau Certified Consultant & Architect. He runs in his spare time & plays various musical instruments.

Read more articles of this author
Let's discuss your data challenges

Join our community of data enthusiasts

Get industry insights, expert tips and Biztory news sent straight to your inbox with our monthly newsletter.