Creating a PNG-image of a VegaLite-diagram directly in memory?

Miroslav-Stimac
Wed, 04 Oct 2023 12:23:32 +0000
General Usage

Hello,

I created the diagram fig with VegaLite.jl and want to send it via e-mail by using SMTPClient.jl without creating a temporary file, but using IOBuffer to do it directly in the memory.
I tried this here, but it does not work:

io = IOBuffer()

VegaLite.save(FileIO.Stream{format"PNG"}(io), fig, "png")
png_data = take!(io)
image_data = base64encode(png_data)

html_e-mail = html_e-mail * " "

Error message:

ERROR: LoadError: UndefVarError: @format_str not defined

Does somebody have an idea what is wrong with
VegaLite.save(FileIO.Stream{format"PNG"}(io), fig, "png")
or knows another method how to send a VegaLite.jl diagram via e-mail without creating a file?

Thanks for any advices in advance!

Kind regards,
Miroslav Stimac

2 posts - 2 participants