Giter Site home page Giter Site logo

avatar_generator's Introduction

avatar_generator

哈希头像图片生成器 Python代码

Identicon 在很多大型IT网站上可以见到,比如 Github, Sourceforge, Stackoveflow 等等, 刚刚注册的账号的个人信息的默认图标​都​是​一​些​看​上​去​像​七​巧​板​拼​凑​的​图​案​,​对​称​又​变​化​多​端​。

以 Github 为例, Github 给无头像用户生成 5x5 像素的 Identicons 头像。 这一生成过程使用了用户ID的哈希值,然后根据哈希值每一位的奇偶值来决定对应位置上的像素的开关。 这样生成 的图像,配上由哈希值决定的颜色,保证可生成大量独一无二的图像。

哈希头像事例:http://identicon.net

根据哈希算法,本项目代码可以通过运行test_batch文件会在相同的目录保存多个png格式的图片。

img= identicon.render_identicon(code, 16)

这里的code是一个数值, 或者字符串数值, 如果code比较大, 比如code=10000000, 生成的图片就是彩色的. code比较小, 比如code=1~100之间的, 生成的图片就是黑白色的.

avatar_generator's People

Contributors

haoziiy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.