Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kkweon/identicon-generator-in-elixir
Identicon Generator in Elixir
https://github.com/kkweon/identicon-generator-in-elixir
Last synced: 24 days ago
JSON representation
Identicon Generator in Elixir
- Host: GitHub
- URL: https://github.com/kkweon/identicon-generator-in-elixir
- Owner: kkweon
- Created: 2017-10-12T00:02:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-12T00:03:07.000Z (about 7 years ago)
- Last Synced: 2024-10-29T08:05:03.235Z (2 months ago)
- Language: Elixir
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
* Identicon
Identicon generator example in Elixir
- Identicon :: An Identicon is a visual representation of a hash value, usually of an IP address, that serves to identify a user of a computer system as a form of avatar while protecting the users' privacy. The original Identicon was a 9-block graphic, and the representation has been extended to other graphic forms by third parties.
* Run
- Install dependencies
#+BEGIN_SRC bash
mix deps.get
#+END_SRC- Go to REPL
#+BEGIN_SRC bash
iex -S mix
#+END_SRC- Run the command
#+BEGIN_SRC bash
iex> Identicon.main "Hello World"
#+END_SRCThe identicon of Hello World
[[assets/Hello World.png]]
* How it works
Let's say there is one string input such as username.
#+BEGIN_SRC elixir
def main(input) do
input
|> hash_input
|> pick_color
|> build_grid
|> filter_odd_squares
|> build_pixel_map
|> draw_image
|> save_image(input)
end
#+END_SRC