Save an image to an IOBuffer

It looks like PNGFiles.jl supports this. For example, compressing a 50x50 single channel image of zeros from 2500 bytes to 213:

julia> using PNGFiles
       img = zeros(UInt8, 50, 50)
       sizeof(img)
2500

julia> buf = IOBuffer();
       PNGFiles.save(buf, img)
       length(take!(buf))
213
3 Likes