Convert png image into base64 string?

how to convert png image into base64 string and vice versa?

1 Like

You probably need to supply more information to get the answer you want. But to answer your question as asked:

using Base64
data = read("image.png")
text=base64encode(data)
println(text)

To go back to a file you would do:

output = base64decode(text)
write("image.2.png", output)

BTW: Googling for “julia base64” bring me to:

https://docs.julialang.org/en/v1/stdlib/Base64/

Which is what I did to answer the question :slight_smile:.

7 Likes