You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4 KiB

  1. identicon
  2. [![Build Status](https://travis-ci.org/issue9/identicon.svg?branch=master)](https://travis-ci.org/issue9/identicon)
  3. ======
  4. 根据用户的 IP 、邮箱名等任意数据为用户产生漂亮的随机头像。
  5. ![screenhost.1](https://raw.github.com/issue9/identicon/master/screenshot/1.png)
  6. ![screenhost.4](https://raw.github.com/issue9/identicon/master/screenshot/4.png)
  7. ![screenhost.5](https://raw.github.com/issue9/identicon/master/screenshot/5.png)
  8. ![screenhost.6](https://raw.github.com/issue9/identicon/master/screenshot/6.png)
  9. ![screenhost.7](https://raw.github.com/issue9/identicon/master/screenshot/7.png)
  10. ```go
  11. // 根据用户访问的IP,为其生成一张头像
  12. img, _ := identicon.Make(128, color.NRGBA{},color.NRGBA{}, []byte("192.168.1.1"))
  13. fi, _ := os.Create("/tmp/u1.png")
  14. png.Encode(fi, img)
  15. fi.Close()
  16. // 或者
  17. ii, _ := identicon.New(128, color.NRGBA{}, color.NRGBA{}, color.NRGBA{}, color.NRGBA{})
  18. img := ii.Make([]byte("192.168.1.1"))
  19. img = ii.Make([]byte("192.168.1.2"))
  20. ```
  21. ### 安装
  22. ```shell
  23. go get github.com/issue9/identicon
  24. ```
  25. ### 文档
  26. [![Go Walker](https://gowalker.org/api/v1/badge)](https://gowalker.org/github.com/issue9/identicon)
  27. [![GoDoc](https://godoc.org/github.com/issue9/identicon?status.svg)](https://godoc.org/github.com/issue9/identicon)
  28. ### 版权
  29. 本项目采用 [MIT](https://opensource.org/licenses/MIT) 开源授权许可证,完整的授权说明可在 [LICENSE](LICENSE) 文件中找到。