views:

288

answers:

6

I am a little curious about the cute little kaleidoscopic images associated with each user on this site. How are those generated? Possibilities are:

  1. A list of images is already there in some folder and it is chosen randomly.
  2. The image is generated whenever a user registers.

In any case, I am more interested in what kind of algorithm is used to generate such images.

+1  A: 

IIRC, it's generated from an IP address.

"IP Hashing" I believe it's called.

I remember reading about it on a blog; he made the code available for download. I have no idea where it was from, however. :(

TraumaPony
+4  A: 

Its usually generated from a hash of either a user name, email address or ip address.

Stackoverflow uses Gravatar to do the image generation.

As far as I know the idea came from Don Parks, who writes about the technique he uses.

Matt Howells
+11  A: 

It's called an Identicon. If you entered and e-mail, it's a based on a hash of your e-mail address. If you didn't enter an e-mail, it's based on your IP address.

Jeff posted some .NET code to generate IP based Identicons.

Chris Upchurch
+1  A: 

The images are produced by Gravatar and details of them are outlined here, however, they do not reveal how they are doing it.

GateKiller
A: 

I believe the images are a 4×4 grid with the upper 2×2 grid repeated 4 times clockwise, just each time rotated 90 degrees, again clockwise. Seems the two colours are chosen randomly, and each 1×1 block is chosen from a predefined set.

EDIT: obviously my answer was ad hoc. Nice to know about identicons.

Try this: http://www.docuverse.com/blog/9block?code=(32-bit integer)8&size=(16|32|64)

substituting appropriate numbers for the parenthesized items.

ΤΖΩΤΖΙΟΥ
A: 

I bet each tiny tile image is given a set of other tile images it looks good with. Think of a graph with the tiles as nodes. You pick a random node for the corner and fill it's adjacent spots with partners, then rotate it and apply the same pattern four times. Then pick a color.

Instead of a graph, it could also be a square matrix in which each row represents an image, each column represents an image, and cell values are weights.

Kevin Conner