-
Notifications
You must be signed in to change notification settings - Fork 9
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
ImageShow.gif ImageShow.play and ImageShow.explore not working in VSCode julia jupyter #54
Comments
Plots.gif works, so it should be feasible using Plots
@gif for i=1:10
heatmap(rand(10,10))
end |
I can confirm that |
EDIT: This hacky solution seems to solve the output problems for me in both Jupyter and VSCode: function Base.show(io::IO, ::MIME"text/html", agif::ImageShow.AnimatedGIF,
minpixels=10^4, maxpixels=10^7,
# Jupyter seemingly can't handle 16-bit colors:
mapi=x->mapc(N0f8, clamp01nan(ImageShow.csnormalize(x))))
io2 = IOBuffer()
img = ImageShow.enforce_standard_dense_array(agif.data)
if !get(io, :full_fidelity, false)
while ImageShow._length1(img) > maxpixels
img = restrict(img, (1,2)) # big images
end
FileIO.save(Stream{format"GIF"}(io2), img; fps=agif.fps, mapi = mapi)
else
FileIO.save(Stream{format"GIF"}(io2), img; fps=agif.fps)
end
seekstart(io2)
write(io, "<img src=\"data:image/gif;base64,$(base64encode(read(io2)))\" />")
end |
I can open a PR if people are interested, cc @johnnychen94 |
Looks like a good enough solution to me! I bet people won't try to create too big gif data here. My solution for vscode display was also a simple one Lines 19 to 21 in 245e0e4
|
I think I need to be a bit more clever than posted above because it probably makes sense to compress differently along XY vs time. I would think something like:
|
Most importantly, even the gif does not show up:
I was expecting an animated figure
The other two interactive functions are failing entirely because it seems that VSCode does not provide interactivity as such.
The text was updated successfully, but these errors were encountered: