You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement a feature that embeds animations in the jupyter notebooks.
The way I'm doing this is to embed a gif as base64 representation.
However, I couldn't find a way to create a gif purely in memory, BitMapBackend::gif requires a path for the gif.
Currently, I'm able to create a temporary file and re-encode it but I don't think it's a clean solution. There are possible issues like what if the name of the temp file conflicts with the user's existing file, whether the jupyter notebook will be shut down unexpectedly that the temp file was not removed successfully, etc.
Another solution for the problem would be generating each frame as an image and using javascript to control them.
I don't quite like this solution since I personally don't want to write too much javascript code. We need to print out javascript code inside rust strings, which is a nightmare for me. This solution will be giving the user more control of the animation since we can even allow user to change the framerate without re-generating the gifs. And from what I saw in the matplotlib codebase, this is how they implement animations.
I think it would be interesting if someone could help with the javascript solution. But I'm currently focusing on the embedded gif solution.
Could someone tell me how I can create an in-memory gif or some other workarounds for this problem? Really appreciate it!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Dear all!
I'm trying to implement a feature that embeds animations in the jupyter notebooks.
The way I'm doing this is to embed a gif as base64 representation.
However, I couldn't find a way to create a gif purely in memory, BitMapBackend::gif requires a path for the gif.
Currently, I'm able to create a temporary file and re-encode it but I don't think it's a clean solution. There are possible issues like what if the name of the temp file conflicts with the user's existing file, whether the jupyter notebook will be shut down unexpectedly that the temp file was not removed successfully, etc.
Another solution for the problem would be generating each frame as an image and using javascript to control them.
I don't quite like this solution since I personally don't want to write too much javascript code. We need to print out javascript code inside rust strings, which is a nightmare for me. This solution will be giving the user more control of the animation since we can even allow user to change the framerate without re-generating the gifs. And from what I saw in the matplotlib codebase, this is how they implement animations.
I think it would be interesting if someone could help with the javascript solution. But I'm currently focusing on the embedded gif solution.
Could someone tell me how I can create an in-memory gif or some other workarounds for this problem? Really appreciate it!
Beta Was this translation helpful? Give feedback.
All reactions