Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rrivera/identicon
Open source avatar generator inspired by GitHub avatars.
https://github.com/rrivera/identicon
avatar golang identity-icon image
Last synced: about 1 month ago
JSON representation
Open source avatar generator inspired by GitHub avatars.
- Host: GitHub
- URL: https://github.com/rrivera/identicon
- Owner: rrivera
- License: mit
- Created: 2018-06-25T20:14:17.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-16T19:54:54.000Z (11 months ago)
- Last Synced: 2024-07-31T09:18:30.105Z (5 months ago)
- Topics: avatar, golang, identity-icon, image
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 88
- Watchers: 4
- Forks: 13
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IdentIcon
![CircleCI](https://img.shields.io/circleci/project/github/RedSparr0w/node-csgo-parser.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/rrivera/identicon)](https://goreportcard.com/report/github.com/rrivera/identicon) [![](https://godoc.org/github.com/rrivera/identicon?status.svg)](http://godoc.org/github.com/rrivera/identicon)**IdentIcon** is an open source avatar generator inspired by GitHub avatars.
IdentIcon uses a deterministic algorithm that generates an image (using Golang's stdlib image encoders) based on a text (Generally Usernames, Emails or just random strings), by hashing it and iterating over the bytes of the digest to pick whether to draw a point, pick a color or choose where to go next.
IdentIcon's Generator enables the creation of customized figures: (NxN size, points density, custom color palette) as well as multiple exporting formats in case the developers want to generate their own images.
## Installation
```bash
$ go get github.com/rrivera/identicon
```## Usage
```go
import (
"os""github.com/rrivera/identicon"
)// New Generator: Rehuse
ig, err := identicon.New(
"github", // Namespace
5, // Number of blocks (Size)
3, // Density
)if err != nil {
panic(err) // Invalid Size or Density
}username := "rrivera" // Text - decides the resulting figure
ii, err := ig.Draw(username) // Generate an IdentIconif err != nil {
panic(err) // Text is empty
}// File writer
img, _ := os.Create("icon.png")
defer img.Close()
// Takes the size in pixels and any io.Writer
ii.Png(300, img) // 300px * 300px```
## Examples
### 5x5
|rrivera | johndoe | abc123 | modulo |
:------------------------------------------------:|:---------------------------------------------:|:-------------------------------------------:|:--------------------------------------------|
![rrivera](./examples/5x5/rrivera.png) | ![johndoe](./examples/5x5/johndoe.png) | ![abc123](./examples/5x5/abc123.png) | ![modulo](./examples/5x5/modulo.png) |
![rrivera](./examples/5x5/rrivera_itx.png) | ![johndoe](./examples/5x5/johndoe_itx.png) | ![abc123](./examples/5x5/abc123_itx.png) | ![modulo](./examples/5x5/modulo_itx.png) |
![rrivera](./examples/5x5/rrivera_github.png) | ![johndoe](./examples/5x5/johndoe_github.png) | ![abc123](./examples/5x5/abc123_github.png) | ![modulo](./examples/5x5/modulo_github.png) |### 7x7
|rrivera | johndoe | abc123 | modulo |
:------------------------------------------------:|:---------------------------------------------:|:-------------------------------------------:|:---------------------------------------------|
![rrivera](./examples/7x7/rrivera.png) | ![johndoe](./examples/7x7/johndoe.png) | ![abc123](./examples/7x7/abc123.png) | ![modulo](./examples/7x7/modulo.png) |
![rrivera](./examples/7x7/rrivera_itx.png) | ![johndoe](./examples/7x7/johndoe_itx.png) | ![abc123](./examples/7x7/abc123_itx.png) | ![modulo](./examples/7x7/modulo_itx.png) |
![rrivera](./examples/7x7/rrivera_github.png) | ![johndoe](./examples/7x7/johndoe_github.png) | ![abc123](./examples/7x7/abc123_github.png) | ![modulo](./examples/7x7/modulo_github.png) |
### 10x10
|rrivera | johndoe | abc123 | modulo |
:--------------------------------------------------:|:-----------------------------------------------:|:---------------------------------------------:|:----------------------------------------------|
![rrivera](./examples/10x10/rrivera.png) | ![johndoe](./examples/10x10/johndoe.png) | ![abc123](./examples/10x10/abc123.png) | ![modulo](./examples/10x10/modulo.png) |
![rrivera](./examples/10x10/rrivera_itx.png) | ![johndoe](./examples/10x10/johndoe_itx.png) | ![abc123](./examples/10x10/abc123_itx.png) | ![modulo](./examples/10x10/modulo_itx.png) |
![rrivera](./examples/10x10/rrivera_github.png) | ![johndoe](./examples/10x10/johndoe_github.png) | ![abc123](./examples/10x10/abc123_github.png) | ![modulo](./examples/10x10/modulo_github.png) |[View examples](./examples)
## Documentation
## Changelog
## Contribution
## License
MITCopyright (c) 2018-present, Ruben Rivera