SO 上的用户 ID 图像是如何生成的?

发布于 2024-07-05 20:42:23 字数 169 浏览 8 评论 0原文

我对这个网站上与每个用户相关的可爱的小万花筒图像有点好奇。 这些是如何生成的? 可能性是:

  1. 图像列表已经存在于某个文件夹中,并且是随机选择的。
  2. 每当用户注册时都会生成图像。

无论如何,我更感兴趣的是用什么样的算法来生成这样的图像。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

青瓷清茶倾城歌 2024-07-12 20:42:23

它称为 Identicon。 如果您输入了电子邮件,则它基于您的电子邮件地址的哈希值。 如果您没有输入电子邮件,则它基于您的 IP 地址。

Jeff 发布了一些 .NET 代码来生成基于 IP 的标识符。

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.

秋心╮凉 2024-07-12 20:42:23

它通常是根据用户名、电子邮件地址或 IP 地址的哈希值生成的。

Stackoverflow 使用 Gravatar 来生成图像。

据我所知,这个想法来自 Don Parks,他撰写了有关他使用的技术的文章。

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.

森末i 2024-07-12 20:42:23

IIRC,它是从 IP 地址生成的。

我相信它被称为“IP 哈希”。

我记得在博客上读过相关内容; 他提供了代码供下载。 然而我不知道它是从哪里来的。 :(

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. :(

苏佲洛 2024-07-12 20:42:23

这些图像由 Gravatar 制作,详细信息为

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

遗弃M 2024-07-12 20:42:23

我敢打赌,每个小图块图像都会被赋予一组看起来不错的其他图块图像。 想象一个以图块为节点的图表。 您为角点随机选择一个节点,并用伙伴填充它的相邻点,然后旋转它并应用相同的图案四次。 然后选择一种颜色。

它也可以不是图形,而是方阵,其中每行代表一个图像,每列代表一个图像,单元格值是权重。

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.

风向决定发型 2024-07-12 20:42:23

我相信这些图像是一个 4×4 网格,上面的 2×2 网格顺时针重复 4 次,只是每次旋转 90 度,再次顺时针旋转。 似乎两种颜色是随机选择的,并且每个 1×1 块都是从预定义的集合中选择的。

编辑:显然我的回答是临时的。 很高兴了解身份标识。

试试这个:http://www.docuverse.com/blog/9block? code=(32-bitinteger)8&size=(16|32|64)

用适当的数字替换括号内的项目。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文