elegant way to display gif file in notebook?
See original GitHub issueHi,
Is there any way to display gif file in super short way? I have at two ways but none of them are really what I want
- Using
HTML
def display_gif(fn):
from IPython import display
return display.HTML('<img src="{}">'.format(fn))
This does not play nicely with browser’s cache. If I remake an image with the same filename, the new image won’t be updated.
- Rename
.gif
to.png
and then usedisplay.Image(fn)
.
thanks.
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
How do I embed a gif in Jupyter notebook? - Stack Overflow
I've been trying to display a gif in Jupyter notebook and have had some trouble. I keep getting a blank image file.
Read more >Embedding GIFs in a Jupyter Notebook! - YouTube
Tutorial on embedding GIFs within a Jupyter Notebook.The notebook can be found in the "Jupyter" folder within the below repo.
Read more >Easily display animated media content inside your Jupyter ...
This tutorial aims to show you how easy it is to create and insert dynamic content in your jupyter notebooks. Exporting this notebook...
Read more >Is it possible to insert an animated image into Mathematica ...
This suggests one solution: using a Manipulate or Animate , with those bunch of images. But is there a less tedious and more...
Read more >Using the Jupyter Notebook environment | ArcGIS API for Python
The page you see in this image is called the Notebook Dashboard. ... and the circle next to the kernal name (Python 3...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As discussed, there are couple different ways to do this:
HTML
Image(filename=*)
orImage(url=*)
by adding apng
extension to GIF fileImage(data=*)
Ideally, we want to be able to
Image(filename=*)
orImage(url=*)
without being required to rename the file and be able to useformat="gif"
. Is there any reason that GIF is not supported format yet? If not, I say we support it 👍Alright, here’s my submission despite the issue being closed: when I tried the other options above, the exported HTML file doesn’t show the GIF, since it doesn’t get embedded base64, so I have the following working solution, (in Python 3.6+)