For this project I scraped a large collection of Monet paintings and used k-means clustering to extract a color palette for each image. When this was complete the final step was to create a data-visualization in D3.

Python Imaging Library

Image handling in Python is usually achieved using the Python Imaging Library (PIL), which provides extensive file format support. It is useful for batch processing images (e.g. creating thumbnail images from an image archive) and basic image processing, such as point operations, filtering, resizing, rotation and transformations. For more advanced image processing the scikit-image project offers a comprehensive collection of image processing routines (e.g. blob detection, edge detection and image labelling).

In [1]:
from PIL import Image
# Use thumbnail version data to make the search space a little more manageable for k-means
im = Image.open("images/7617.jpg")
In [2]:
Image.open("images/7618.jpg")
Out[2]: