Skip to content
No description, website, or topics provided.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
media
README.MD
batch_color_analyzer.py
color_histogram_plot.py
photo_colorbar.py
storage.pkl

README.MD

Color Me Impressed

Introduction

This project was an extension of the work I read in this blogpost It's a series of funcitons that batch analysze tiffs and then

note : These functions always run faster on smaller images. To save yourself someheadache scale down the images before you run them by using the sip command in bash.

Simply navigate to the image folder and execute:

sips -Z 100 *.jpg

This will generally preserve the colors but scale everything down.

Getting the data

I used instalooter to collect data but any scraping service that allows you to collect large amounts of images should work.

Analyszing one image

The function photo_colorbar.py takes two arguments: the location of the image and the number of color to extract

python3 photo_colorbar.py %PathToImage% n

As an example of n=5, we see this function will generate an output like this:

girl

Batch Analysis

To find the primary colors in a series of images you can call the following function

python3 batch_color_analyzer.py %PathToImageDirectory% n

This will save a pickled python list of lists called "storage.pkl" containing the "n" most promoinent colors for each image in the directory.

Plotting

To generate unique radial plots using the extracted data you can simple run the function:

python3 color_histogram_plot.py

This will load "storage.pkl" and generate a smoothed radial histogram based on the hues of the scraped images. *note: * There are many ways to visulaize distributions of color, here we simply discard black and white and look at the predominance of the colors of the rainbow. girl

You can’t perform that action at this time.