Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOBuffer support #22

Closed
2 of 3 tasks
johnnychen94 opened this issue Sep 10, 2020 · 1 comment
Closed
2 of 3 tasks

IOBuffer support #22

johnnychen94 opened this issue Sep 10, 2020 · 1 comment

Comments

@johnnychen94
Copy link
Member

johnnychen94 commented Sep 10, 2020

following all the way from JuliaIO/ImageIO.jl#6 and JuliaImages/Images.jl#912, it turns out #14 isn't so generic...

Tracking down with debugger, here's a minimal example that reproduces the issue:

julia> using Base64, ImageCore, PNGFiles

julia> io = Base64EncodePipe(IOBuffer())

julia> img = rand(RGB{N0f8}, 2, 2)

julia> PNGFiles.save(io, img)

The result take!(io.io) is then passed down to VSCode or whatever displayer.

I'm not familiar with libpng and C bindings to fix the issue, but the root problem seems to be

png_set_write_fn(png_ptr, s.handle, writecallback_c[], C_NULL)

Instead of writing to file handle, here we need to write contents to IO buffer via the Base64 encoder pipe s. I don't know how the pointer of s can be passed to libpng, though. Any guidance would be helpful.

Other related PRs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant