Closed fonsp closed 3 years ago
Should I post this issue to Images.jl instead?
How does this work in Jupyter though.
Edited: (I mean showing an Image does work, I tried it. But why is it different in Pluto vs Jupyter.)
Could be because of the IOContext - could you try calling show(stdout, MIME”image/png”(), i) inside jupyter?
It's fixed if I also install ImageMagick:
(@v1.4) pkg> add Images ImageIO ImageMagick
julia> using Images
julia> i = Gray.(rand(4,4))
julia> show(stdout, MIME("image/png"), i)
[ Info: Precompiling ImageMagick [6218d12a-5da1-5696-b52f-db25d2ecc6d1]
�PNG
IHDRdU�ʈgAMA��
�P���T@tT��a��n��`�Lpm�9�~����p��Q<bKGD���̿zIDATh��ϡ
;R����0��@ �6�r�p��u}�@ ���3�)����@ H�%�G
�>]�@ �@�� %�@IEND�B`�253
The 4-errors-in-1 made this difficult to find - is there a way to make the error message more helpful?
show(stdout, MIME”image/png”(), i)
Haha
I think Jupyter does a Base64 encoding here... and send that in a JSON, which the front end shows by creating an img tag with src=data:bas64...
.
You probably already know that.
But then you are still just calling show(io, MIME"image/png"(), i)
right? Except into an IOBuffer or base64 pipe instead of to your pixels directly. I don't get why it works for jupyter...
Awesome, thanks!!
Setup
Calling the
show
method: