For this blog, I will try to explain how to create a portrait in Tableau of whatever you want with the colours as they appear. It should be noted that this is purely an aesthetic thing to do in Tableau.

List of Programmes needed:

R
Tableau
Alteryx
Notepad++

To begin with, I used an Alteryx tool (macro) from Ben Moss at the information lab. this tool if used with a text input for an image location will tell you information about the image. However for this tool to work you need to download R and then download the “PNG” package

To get PNG, open R and install packages. You can use the gif below to help. I install using the R shell, I click Australia (Melbourne1) as the REgion and then scroll down to PNG. Then it gives me the address of were that zip is.

Try to Zip it to 1 or both of these files if you have them. I wasn’t sure which version of R I was using, so I did it to both.

After that, the tool should work.

 

The next step is to output to a hyper in Tableau. Once done, put the pixelX and pixelY on rows and columns, reverse Y axis. and put HEX on colour. In doing this you get a crazy result:

Next you want to save as a .twb. Once this is done, close tableau and go to where you saved it. Right click and open in Notepad. You should see the below image.

In black and further on down is the info you want to copy out. COPY ALL LINES from the start of <map to=#(what you have)> and down to the last </map>. There should be about 256 colours due the alteryx tool used.

Refer to the Alteryx workflow above for the next steps. Use a text input and paste those copied values. Filter out the bucket and map to stuff. Filter further to get those two values separate. USe a record ID to then join together, as the format of the XML in notepad is in this format. Use a symbol like @ to then parse out to rows the separate components. I also added the ending <\map> as well using a formula. Once you get the final result of 768 rows (256*3) copy the result and paste it into the notepad where the same information was. Save the notepad and open the Tableau workbook up. The result should be that all colours now match the hex codes.

This can be done for any image.

here is a link to the Viz.