Creating ‘Colour Stacks’ in Tableau

Since I published by ‘Colours of TinTin’ viz I’ve had a few people ask me how I extracted the colours and created the colour blocks, so thought it was time to finally keep my promise and write up some instructions that will hopefully help you to create your own masterpieces.

Before we get started

When I initially got the idea, I was going through all the tools I had collected; and what I found was that they all extracted the same number of colours and/or didn’t take into consideration the finer differences between colours (and some made extracting the HEX codes a bit too complicated for my liking).

The challenge I had was that I wanted to create a recognizable abstract representation which meant accounting for the fact that all the covers were very different in how they used colour. The tool I ended up using offered more flexibility/control on how those colours would be sampled. If you know of any other tools that could achieve the same (or potentially better); please let me know by leaving a comment at the bottom of this page.

At the end of this post you’ll also find a short overview of some of the tools that I tested as I was working on this project; and I also included a few other favourites (**) that I recently discovered.

For the purpose of this post/tutorial I’m only covering how I prepped the data as that was where I spent most of my time; and where I believe it makes sense to provide a bit more detail. You’ll find that creating the stacks in Tableau is actually pretty straightforward so I invite you to view/download my workbook from Tableau Public (click on image below) to reverse engineer

Creating Colour Stacks in Tableau@2x

A few considerations

Before you start sampling images, please consider the following:

  • Once you have decided on the sampling parameters, make sure you apply the same for all images.
  • The pixel size of your images matters and should be the same for all as the sampling will be impacted by the image quality.

If you’re just looking to create your own colour palettes, then one could argue that the above considerations don’t really matter as it would be a more subjective exercise. But if you are going to make an abstract representation of a series of images, I believe it makes sense to apply the same parameters & pixel ratios for all images allowing for a more objective comparison and analysis.

Two more sidenotes:

  • For obvious reasons, extracting colours from a picture you’ve taken from an object or landscape will yield different results then when you use a cartoon image as your source.
  • The greater the pixel size, the better the sampling

Ok so let’s do this.

Click here for access to the tool I used to extract the colours.

Full disclosure. I used different parameters for my TinTin viz (you can find them in the TXT file of the HEX codes I shared, see link below), but the overall principle is the same.

Tutorial

STEP 1: Running your image(s) through the tool

For information on the different parameters and what they mean, I refer you to the instructions by the creator of the tool. I should mention they are in French. So if you’re a bit ‘challenged’ in the language department; I recommend using a translator like Deepl to help you out.

Rothko1

To extract the colour information, click on ‘Sv.palette’ underneath the coloured bars and it will extract the details into a CSV file (like the image below).

csv

STEP 2: Collating the relevant data and creating your data source

Now that you have the data from the tool, it’s time to clean it up a bit in Excel and add in some additional columns. The ‘orange’ columns are what I added in, the other 2 are what’s left over from the CSV file. I’m not going to write instructions on how to clean up the data in Excel, I assume you know you’re way around and understand how you could use ‘Find’ and ‘Replace’ to make that task a bit simpler.

datastructure@2x

PROPORTION

Pixels / Total Pixels per Picture ID

COLOUR ORDER

It’s very important that when you start building your stacks; that the order of the hex codes in your *.tps file is identical to the order in your data source, otherwise there will be mismatches. So by adding in this unique identifier, it makes it a bit easier to validate. As with anything I’m sure there’s different ways of doing this but this is what worked for me.

STEP 3: Add HEX codes to your ‘Preferences.tps’ file

This part is always the most tedious as you have to add in some code before you can copy paste to your *.tps file. To make it a bit easier you can create a simple tool in Excel that will make this go a lot faster. You’re welcome to download my version by clicking here or you can simply create your own, it’s not rocket science.

tps@2x

STEP 4: Connect to your data source and start building your viz

Now that you have completed all the data prep, you simply connect to the data source in Tableau and you’re good to go. You’ll see it’s really very simple. Should you get stuck, feel free to use the comment section below to leave your questions and comments.

This slideshow requires JavaScript.

Additional Resources

Colour Extraction Tools

TinEye – Color Extraction Lab

Canva

Color Extractor

Color Extractor from coolphptools.com

Palette Generator

Adobe Capture (**)

Palette Maker (**)

The Colours Of TinTin

Viz on Tableau Public

HEX Codes

High Res Images

Presentation

Thanks for reading and feel free to leave your feedback or questions in the comment section below.

Author: Marian

Tableau Fan, Foodie, Travel, Photography

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s