This is a script made for this popularity contest on the "Programming Puzzle & Code Golf" Stack Exchange. The script takes an input image and outputs a "paint by number" version of the image where the number of contiguous cells and colours used are limited.
This Python 2 script was written as a quick prototype and is hence very messy -- if redone I would remake the script from scratch with a similar algorithm, using scikit-image for the RGB/LAB conversion and scikit-learn for the clustering.