image64 is a library for elixir that helps convert base64 images into regular image files.
If available in Hex, the package can be installed as:
-
Add image64 to your list of dependencies in
mix.exs
:def deps do [{:image64, "~> 0.0.1"}] end
-
Ensure image64 is started before your application:
def application do [applications: [:image64]] end
First import the module
import ImageBase64Handler
if you want to convert a base64 url and output it to a file
base64ToImage(base64data, fileOutputPath)
This will output the image to the designated fileOutputPath
if you want to convert base64 file and convert it to an image file
base64urlFiletoImage(fileInputPath, fileOutputPath)
if you want to convert a image to a base64url file
imagetobase64(fileInputPath, fileOutputPath)
This will take a image file path and an output file path and output the base64 data into that file
Those are the two key functions to convert to and from base64 images
Open a issue or pull request and I will take a look.