RoboHash and Gravatar

I recently discovered a charming web service called RoboHash which returns an image of a robot deterministically as a function of some input text. Take a gander at a smattering of random robots:

These would make an awesome fallback as an avatar for those without a Gravatar set up, since it will always give you the same robot if you enter the same email address. So of course I implemented it for this site!

The Python to build a Gravatar URL which will fallback properly is roughly as follows:

import hashlib
size = 45
hash = hashlib.md5(email.strip().lower()).hexdigest()
robohash_url = 'http://robohash.org/%s.png?size=%sx%s&bgset=any' % (hash, size, size)
avatar_url = 'http://www.gravatar.com/avatar/%s?s=%s&d=%s' % (hash, size, robohash_url)

Leave a comment on this post to see what your robot looks like!

Posted .
7 comments.
  1. avatar
    Mike Boers

    With my UBC CS email.

    Posted .
  2. avatar
    Tanya

    TANYABOT says Hi Mike!

    Posted .
  3. avatar
    Lianne

    I want a robot. Where's my damn robot!?!?!?!?!?

    Posted .
  4. avatar
    Shane

    Ooooo!!! (Anticipatory oooo.)

    I was going to prepend my email with mikeisastinker. but I wanted to see my actual robot. =)

    Posted .
  5. avatar
    Shane

    Stupid gravatar!!!

    Posted .
  6. avatar
    Shane

    http://robohash.org/044eb13b3770151bed3d01fcc59ba536.png?size=100x100&bgset=any

    Ahh, I wanted a green one…

    Posted .
  7. avatar
    Sina

    Of course i get a Pink one
    http://static1.robohash.com/SilverCyrex

    Posted .
  1. (required)
  2. (required)
  3. (optional)
  4. (required)