Identicons v0.1.0 Identicon View Source

Documentation for Identicon.

Example

iex>Identicon.main "test", 250
:ok

Link to this section Summary

Functions

Adds a grid to %Identicon.Image{} as a list of tuples with the values and the index

Extends the index of the grid to 50px squares as {{x_top_left, y_top_left}, {x_bot_right, y_bot_right}}

Uses a erlang image library to create a image with the rectangles from pixel_map

Removes odd numbers from the grid

Creates a hashed list from the input and returns the result as %Identicon.Image{hex: hex}

Adds a mirror of the row to it self

Takes in the data struct %Identicon.Image{} and saves it in image

Link to this section Functions

Adds a grid to %Identicon.Image{} as a list of tuples with the values and the index

Enum.map(&mirror_row/1) same as Enum.map(&mirror_row(&1))

Link to this function build_pixel_map(image, size) View Source

Extends the index of the grid to 50px squares as {{x_top_left, y_top_left}, {x_bot_right, y_bot_right}}

Uses a erlang image library to create a image with the rectangles from pixel_map

Removes odd numbers from the grid

Creates a hashed list from the input and returns the result as %Identicon.Image{hex: hex}

Link to this function main(input, size \\ 250) View Source

Adds a mirror of the row to it self

Takes in the data struct %Identicon.Image{} and saves it in image

Then atribues to r, g, b the values of the first 3 items in the hex: [] on the list and leaves the rest

%Identicon.Image{hex: [r, g, b | _]} = image

Never change a variable, only create a new one with diferent values

%Identicon.Image{image | color: {r, g, b}}
Link to this function save_image(image, input) View Source