Saving an image to a PNG file is not a problem, the following code works fine (using Julia 1.5, FileIO 1.4.1 and ImageIO 0.3.0):
using FileIO
image = rand(UInt8, 200, 150, 3)
save("test.png", image)
However, I cannot find how to save the PNG image to a RAM buffer instead. I tried this:
io = IOBuffer()
save(Stream(format"PNG", io), image)
data = take!(io)
There's no error, but the resulting data is much too small: just 809 bytes (instead of about 90kB for the test.png file).
What am I doing wrong?