identicon_dan1d v0.1.0 Identicon View Source

Package to create a image based on a string as github does.

Link to this section Summary

Functions

Creates a grid

it has an strign and returns a list of binaries

Creates an image icon based on a string, it hashes the string and based on that hash it produces the same output for the same input

Mirrows a row

It pick a color in RGB format and adds it to the Identicon.Image struct

Link to this section Functions

Creates a grid

Examples

iex> image = Identicon.main(“banana”) iex> image.grid [

{114, 0},
{179, 1},
{2, 2},
{179, 3},
{114, 4},
{191, 5},
{41, 6},
{122, 7},
{41, 8},
{191, 9},
{34, 10},
{138, 11},
{117, 12},
{138, 13},
{34, 14},
{115, 15},
{1, 16},
{35, 17},
{1, 18},
{115, 19},
{239, 20},
{239, 21},
{124, 22},
{239, 23},
{239, 24}

]

Link to this function filter_odds_squares(image) View Source

it has an strign and returns a list of binaries

Examples

iex> input1 = Identicon.hash_input “banana” %Identicon.Image{

hex: [114, 179, 2, 191, 41, 122, 34, 138, 117, 115, 1, 35, 239, 239, 124, 65],
color: %{},
grid: nil

} iex> input2 = Identicon.hash_input “banana” iex> input1.hex == input2.hex true

Creates an image icon based on a string, it hashes the string and based on that hash it produces the same output for the same input.

Examples

iex> Identicon.main(“test1”) :ok

iex> Identicon.main(“test2”) :ok

Mirrows a row

Examples

iex> Identicon.mirrow_row([1,2,3]) [1,2,3,2,1]

It pick a color in RGB format and adds it to the Identicon.Image struct.

Examples

iex> Identicon.pick_color(Identicon.hash_input(“banana”)) %Identicon.Image{

hex: [114, 179, 2, 191, 41, 122, 34, 138, 117, 115, 1, 35, 239, 239, 124, 65],
color: %{ red: 114, green: 179, blue: 2 },
grid: nil

}

Link to this function save_image(image, input) View Source