averaging the main color in 300 posts, @chanelofficial
For this project, I'm using various tools to get the pictures from Instagram accounts and extract their "average" color. I combine all the following steps in one shell script to automate the process. I open sourced the script, you can access it in this repository. The steps are the following:
• I'm using puppeteer to automatically connect to my instagram account and access the account I am interested in.
• With puppeteer again, the script scrolls the page and gather image urls in a list.
• With the wget command, the images are downloaded from the created list of urls.
• For every image, I'm using a python script to compute the average color with a k-means algorithm. Credits go to Charles Leifer for its original script.
• The colors are then parsed into a JSON array, in the same script.
• The colors are then visualized with d3.js in this article. This is not included in the shell script.
For every picture, I would like to extract the most representative color. But what should be the most representative color? There are actually many ways to think of the "most representative" one.
Here, I'm computing an "averaged color" of the full picture. It is not completely accurate, as, for instance, a 50% black and 50% white picture will render an average grey colour. Still, it is the method I found the most relevant to get a sense of trends for brands on social media.
Below are the "average color" for a sample of 3 images.
from top to bottom: from @chanelofficial, @kenzo, @desigual
Below are color wheels from 300 images from 3 different brands: Chanel, Kenzo & Desigual.
The project being fully automated, such analysis could have been done for any hastag or account. I've chosen to analyse brands as each brand comes with its color identity, but it's even more relevant with photographs or artists playing with colors.
< back to datavizCollection