Identicons

I really like the idea of Don Park’s identicons.
His aim is largely to use it as a way to recognize commenters in blog posts by evaluating their IP address. Since the human eye or rather, the human brain is faster at telling images apart than it is at finding differences in written IP addresses, this makes commenter validation much easier. Alas, since I don’t have many commenters I went for a different application. I implemented a .NET class that creates bitmaps from an integer input value, very much like Don described it here. The create method takes an integer and a size value and returns an Image.Bitmap which can be saved or used within the application. I didn’t take a look at the source code provided since I don’t understand like Java very much. I started from scratch using GDI+. There is a handy object available called GraphicsPath. It is a container for shapes like lines, polygons and so on. These objects can be manipulated through a transformation matrix. Just the right thing for the shapes that make up the identicon. The implementation is probably very ineffective in terms of runtime performance . I have tried to keep it as simple as possible in order to understand what’s happening even later on! :-)

Here you can download the class. Feel free to use it. Feedback is appreciated.

Download identicon.zip

.NET 2.0 is required but only for the generic lists that hold the shapes, it should be easy to port it back to .NET 1.1.

Leave a Reply