View Source Abatap (abatap v0.2.0)
Generate a basic PNG avatar from first name and last name. Largely based on https://github.com/zhangsoledad/alchemic_avatar and code by Sergio Tapia.
Link to this section Summary
Functions
Generates an image using first name and last name of a user using imagemagick's convert command line tool.
Link to this section Functions
Generates an image using first name and last name of a user using imagemagick's convert command line tool.
This function was cribbed from Sergio Tapia (https://sergiotapia.com/)
https://elixirforum.com/t/generate-images-with-name-initials-using-elixir-and-imagemagick/12668
examples
Examples
## default options
# - palette: :google
# - shape: :square
# - size: 512
# - padding: size * 0.546875
iex> Abatap.create_from_initials("John", "Doe")
{:ok, "/var/folders/bq/v60646nd7370n3lffmgfh94r00016k/T/JD-google-1731556906832.png"}
iex> Abatap.create_from_initials("John", "Doe", palette: :google)
{:ok, "/var/folders/bq/v60646nd7370n3lffmgfh94r00016k/T/JD-google-1731556436238.png"}
iex> Abatap.create_from_initials("John", "Doe", palette: :iwanthue, shape: :circle)
{:ok, "/var/folders/bq/v60646nd7370n3lffmgfh94r00016k/T/JD-iwanthue-1731557222647.png"}
iex> Abatap.create_from_initials("John", "Doe", palette: :google, shape: :squircle, size: 1024, padding: 400)
{:ok, "/var/folders/bq/v60646nd7370n3lffmgfh94r00016k/T/JD-google-1731556436238.png"}