猿问

如何在Jupyter笔记本中嵌入gif?

我一直试图在Jupyter笔记本中显示gif,但遇到了一些麻烦。我不断得到一个空白的图像文件。

我试过使用此GitHub存储库中的html 。

![wignerfunction][1](../gifs/wigner_rotation_animate.gif "wigner")

from IPython.display import 
ImageImage(url='example.gif')

到目前为止,以上方法均无效。


慕少森
浏览 369回答 3
3回答

慕桂英546537

当我需要在jupyter笔记本中包含gif动画时,请执行以下操作:<img&nbsp;src="FileName.gif"&nbsp;width="750"&nbsp;align="center">width和align参数由您定义。

交互式爱情

您想要在python jupyter笔记本中显示的任何图像格式png,jpg,jpeg或gif等,然后只需使用matplotlib库即可。import matplotlib.pyplot as pltimport matplotlib.image as mpimgimg = mpimg.imread("/home/gaurav/assignment/sofcomputing/river.gif")plt.imshow(img)
随时随地看视频慕课网APP

相关分类

Python
我要回答