I’ve experimented with a little tool to convert a name into a face for yesterday’s fun 24-Hours Application Challenge at Friendfeed. Each input produces exactly one avatar from over 100,000 possibilities (but not every avatar maps back to exactly one name).
How does the conversion work? There are four basic shape types, face silhouette, pair of eyes, nose and mouth. Each comes in 18 different styles, so I created a bunch of pixel pictures for that. The tool then combines each part into an overall face using transparency. To decide which specific style to choose for each part, the converter looks at the string entered in this way: e.g. character 1, 5, 9, 13... are added up by using their Unicode number (with thanks to Henri Sivonen’s utf8ToUnicode function), and then that number’s divided by 18 and whatever remains as remainder (i.e. modulo operation) will settle the specific face silhouette number. Then the same is repeated for the nose using character 2, 6, 10 and so on.