It’s my particular conceit that I’ve been exposed to just about everything under the sun when it comes to computing. And I’m always disabused of this when I dig into an area I never have before.

I never took a deep interest in blogging until recently so I didn’t really know about Feed Burner, Google Webmaster Tools, site maps, etc. One of the things I’d never heard about were “gravatars” (Globally Recognized Avatars). They’re just little images that represent you in blogs. They’re supposed to be pulled automatically when you post a comment. I immediately thought “cool” and “contact pictures”. Gravatars don’t have to be pictures of people but in practice, they tend to be. So, I dumped my address book to CSV (using A to G.app), wrote a quick Ruby script, and voila, I had two contacts with gravatars. And now, I have one too.

Gravatars couldn’t be simpler, you setup an account at gravatar.com and upload one or more small pictures. Anyone can access the pictures based on email address. The email addresses are hashed by MD5 (so that no one can reverse engineer the email address from the displayed contact picture).

And, of course, some smart people have written plugins for various email programs to suck these in.

For those who are interested, I’m including the complete Ruby program (it will have to be modified for your setup and your platform):

#!/usr/bin/ruby

require 'rubygems'
require 'fastercsv'
require 'digest/md5'
require 'open-uri'

def pull_gravatar(name, email)
  if email and email.length > 0
    puts "Attempting to pull gravatar for #{name} - #{email}..."
    digest = Digest::MD5.hexdigest(email.downcase)
    gravatar_url = "http://www.gravatar.com/avatar/#{digest}?d=http%3A%2F%2Fjunk.com%2Fjunk.jpg"
    begin
      open("#{name} - #{email}.jpg", "w").write(open(gravatar_url).read)
      puts "  FOUND"
    rescue
      puts "  image not found"
      File.delete("#{name} - #{email}.jpg")
    end
  end
end

FasterCSV.foreach('/Users/<userid>/Desktop/Contacts.csv', :headers => true) do |row|
  name = row['Name']
  pull_gravatar(name, row['E-mail'])
  pull_gravatar(name, row['Section 1 - E-mail'])
  pull_gravatar(name, row['Section 2 - E-mail'])
  pull_gravatar(name, row['Section 3 - E-mail'])
end