Experiment 002

In our second experiment we’ve been playing around with the Instagram API. The basic idea was to create mosaic images from Instagram photos tagged with something we like, for instance #cats (internet is made of cats, anyway).
To begin with, we fetch a gazillion images with the tag in question. By resizing the images to 1 x 1 pixels, we get the dominant color of the photo. The RGB value along with a tiny copy of the photo is saved for later.
Instagram API also provides a real-time feature that lets you subscribe to updates, like users, tags etc. We registered a subscription for the tag #epmosaic. When there is a new photo with the tag #epmosaic, an update object is posted to our subscription callback url. In our callback method, we fetch the latest photo tagged as #epmosaic.
By resizing the photo to a suitable size and going through the color of each pixel in it, matching the color with the RGB values of the images in our database, we recreate the photo with our tiny images of cats!
Download the code, but keep in mind that it’s just an experiment so it’s not exactly robust or neatly structured.