Unique != Distinguishable

Had you asked me a week ago, “What’s the most difficult part about generating identicons?”, I would have answered, “Making them look good, obviously.”
Turns out I was wrong. It’s actually quite easy to configure an image generator to produce beautiful images: Take care your colors don’t clash and you should be fine.

The problem lies somewhere else. It’s obvious and easy to overlook at the same time: Images need to be complicated enough to make them unique. At the same time, complexity makes them harder to distinguish. Sadly, this only occurred to me when my image generator was fully implemented and I tested it with some strings.

old_avatar
My first try

I tried to improve results by also encoding color palettes, dot sizes and dot shapes, but that didn’t help. So I decided to start over. This time, I wanted to avoid my mistake at all cost. I brainstormed first.

What makes images distinguishable?

In general, less is more. It’s easier to recognize images with

  • few different shapes
  • few elements
  • few colors

However, less content equals fewer possibilities. Since SHA-1 hashes are 40 hex digits long, there need to be at least 16^{40} = 2^{160} possible results. This leads me to my second question:

How can I produce a huge amount of unique images while following above rules?

I came up with an easy way to do this: Map the hash to 2D-coordinates.
By doing so, the number of possible results is squared. But what shall I do with those coordinates? A simple plot would contain too many dots. Connecting them with lines might be an option, but that would also increase complexity.
Inspired by my love for origami, I decided to generate 7 triangles that share edges. The results look a bit like folded paper.

I’m really pleased with this result, and I think I might just have found content for my first web app. Yay!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s