github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/identicon/README.md (about) 1 identicon [](https://travis-ci.org/issue9/identicon) 2 ====== 3 4 根据用户的IP、邮箱名等任意数据为用户产生漂亮的随机头像。 5 6  7  8  9  10  11 12 ```go 13 // 根据用户访问的IP,为其生成一张头像 14 img, _ := identicon.Make(128, color.NRGBA{},color.NRGBA{}, []byte("192.168.1.1")) 15 fi, _ := os.Create("/tmp/u1.png") 16 png.Encode(fi, img) 17 fi.Close() 18 19 // 或者 20 ii, _ := identicon.New(128, color.NRGBA{}, color.NRGBA{}, color.NRGBA{}, color.NRGBA{}) 21 img := ii.Make([]byte("192.168.1.1")) 22 img = ii.Make([]byte("192.168.1.2")) 23 ``` 24 25 ### 安装 26 27 ```shell 28 go get github.com/issue9/identicon 29 ``` 30 31 32 ### 文档 33 34 [](http://gowalker.org/github.com/issue9/identicon) 35 [](https://godoc.org/github.com/issue9/identicon) 36 37 38 ### 版权 39 40 本项目采用[MIT](http://opensource.org/licenses/MIT)开源授权许可证,完整的授权说明可在[LICENSE](LICENSE)文件中找到。