Creating a Photomosaic of Twitter followers

One of the Twitter accounts I manage professionally recently passed the 30,000 followers mark. This was a big milestone for us, and we wanted to mark it with something special.

We came up with this:

This photomosaic is made up of the avatars of the people who follow us. We got a lot of people asking how we created this, so this blog post is to give you some pointers (it is not a complete How To)…

There are three stages to creating a photomosaic like this:

  1. Capture the details of all your followers
  2. Download their avatars
  3. Use those pictures to create the PhotoMosaic itself
  4. (there is then the fourth stage of actually sharing this with your followers – and there is a bit of a tip for this too!)

If you use this technique I’d love to see what you come up with. Leave me a comment with a link to your picture!

SO lets get started!

Capture the details of your followers

Since Twitter tightened up their API, it has become harder than it used to be to download the followers of a twitter user. You can now only download your followers 15 pages (of 200 users) at a time: https://dev.twitter.com/docs/api/1.1/get/followers/list. That means it takes a substantial length of time to download 30,000 – not to mention the added complication of having to verify all your requests (it used to be a heck of a lot easier!!)

Luckily, I have recently discovered the amazing ScraperWiki website. This amazing site allows you to scrape data from PDFs, websites and open APIs. They describe themselves as a platform for doing data science on the web.

To scrape the followers of a twitter account, you need to set up a free community account with ScraperWiki, then follow these instructions on the ScraperWiki blog

It could take a long time (depending on how many followers you have) and you will need to sign into the tool with a twitter account (for Twitter to log the API calls against). I strongly suggest setting up a second twitter account purely for scraping purposes – so that the API calls don’t limit your searches on Twitter with your main twitter account.

Once the scrape is complete, download the complete list as a spreadsheet.

Download your followers’ avatar photos

This could be a bit difficult – we had 30,000 (give or take the accounts that were protected) photos to download.

Luckily I managed to hack together a handy Excel spreadsheet to download the images (or any other files you’d like to throw at it).

It’s not completely bulletproof – but you can download the spreadsheet here: Download a list of files from internet – by Wobable (it uses Macros, and needs to be a trusted document to work).

Key things here…

  • Test it with a few files before you go for a huge download.
  • I’d suggest creating a separate folder to store the images.
  • Make sure the photos are stored on a computer that you can install the  PhotoMosaic software on (yes, this is the voice of experience – I had to move 30,000 images to another network via DropBox. Not something I’d recommend!)
  • The PhotoMosaic software will only create images from jpgs. If you want to include png or gif files, you will need to re-save these as jpgs. The best way to do this is a batch process in PhotoShop.
  • The spreadsheet won’t ask before saving over an existing file. This is particularly important if you want to accurately represent the number of “eggs” (Twitter accounts where there is no avatar). The eggs are stored in the form: https://abs.twimg.com/sticky/default_profile_images/default_profile_X_normal.png, with one of 7 numbers in place of the X:
0 1 2 3 4 5 6
  • If you want to use all the eggs, you’ll need to specify unique filenames (perhaps the twitter username?) in column 2 of the spreadsheet when you download the photos.

Create the PhotoMosaic

Now you have all the photos, the last stage of the process is creating the actual photomosiac. I found the very clever (and free!) program AndreaMosaic: http://www.andreaplanet.com/andreamosaic/

The software page includes comprehensive tutorial, FAQ and forum pages, so I will only quickly cover the process of creating a mosaic:

  1. Start by indexing all the small photos into a collection. Once you’ve done this once, you can use the same collection to create multiple photomosaics.
  2. Set the parameters of the process (for instance how many images do you want to use in the final image, how much do you want to alter the colours etc).
  3. Upload your matrix photo (the big image). This needs to be a JPG. A photo will work best – ideally one with lots of different colours and patterns within it.
  4. Press “Create the Mosaic”! The process can take a long time (the one I did above took around 20 minutes) but it is well worth the wait!

Bonus Tip…presenting the image…

One of the great things with the final image is being able to zoom in and out of the image. While you can do that to a certain extent on Flickr and Facebook, there is an amazing project called Zoom It (from Microsoft) that is very good for this sort of thing. It works very well – allowing you to zoom right in to see individual images, then zoom out to see the whole effect. At least it did until the Zoom It website decided that we breached their Terms of Use (I suspect over copyright of the individual images included in the mosaic). It took them a month or so to block our image – and there is a hack to get the image back up there again (see “Can I refresh my image” in the FAQ: http://www.zoom.it/pages/faq/) so it might still be worth considering if you have a specific project in mind.

Here is my image in Zoom.It – but if it gets blocked again I won’t be re-linking it again.

[zoomit id=”EJt0″ width=”auto” height=”400px”]

Another way of presenting the image in a zoomable way (the close ups are not as sharp though) would be to embed the image in a Prezi…(I an not altogether great with prezi yet, so this is a proof of concept rather than a full on presentation).

[prezi id=”5l4wc1ghag4g” width=500 height=400 lock_to_path=0]

That’s it! Leave me a comment with a link to your own PhotoMosaic if you find this useful!

2 comments to Creating a Photomosaic of Twitter followers

  • Mark Cookson

    Is there a minimum number of Avatars this ideally works for?

  • Andrew

    Honestly don’t know. I’d look at around 5000 as being a minimum but that figure is plucked from the air, and based on the fact that loads of our followers now have eggs as avatars (rather than anything meaningful!).

    The bigger issue is that Scraperwiki can no longer be used to download a list of Twitter followers (Twitter got in the way – grrrr). You might be able to do something with https://mashe.hawksey.info/2011/03/export-twitter-followers/ but I have not tried it.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>