sergio
Generate images with name initials using Elixir and ImageMagick
https://sergiotapia.me/generate-images-with-name-initials-using-elixir-and-imagemagick-374eca4d14ff
Hope this saves you guys some time! Using ImageMagick and some fancy flags is all you need to generate nice initial avatars for your users.
Most Liked
kip
Thanks for the motivation to fix a couple of bugs in Image. As of version 0.26.0 its easier to generate text-based avatars and to produce either square or circular avatars.
There’s no specific support for text-based background color generation but that might be interesting to add to the Image.Color module.
iex> Image.avatar!("./test/support/images/Kip_small.jpg", shape: :square)
iex> Image.avatar!("./test/support/images/Kip_small.jpg", shape: :circle)
iex> Image.Text.text!("KC", background_fill_color: :cyan, font_size: 200, padding: 80)
...> |> Image.avatar!(shape: :square)
iex> Image.Text.text!("KC", background_fill_color: :cyan, font_size: 200, padding: 80)
...> |> Image.avatar!(shape: :circle)
Since Image is based on vix and libvips the code is fast and memory efficient. Definitely faster than using ImageMagick since vix is NIF based. And generally considered more secure that ImageMagick too.
sergio
Thank you random chinese bot scraper website! I lost my old blog and now I can recover this post!
maz
Popular in Guides/Tuts
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex













