感谢您提前帮助我
我有一个gif文件说sample.gif,我想在我的.ipynb
中显示此GIF文件,或者不打开新窗口,却拥有一系列的.gif
文件,并且我正在创建子图来显示gif,但无法显示找到更好的解决方案
我看到pyglet,但是它会打开新窗口以显示gif。由于我只有GIF文件,因此我认为这里没有提供代码
感谢您的帮助
编辑:尝试下面的代码将给出错误:TypeError: Image data of dtype <U10 cannot be converted to float
import matplotlib.pyplot as plt
plt.imshow('sample.gif', cmap='gray')
我找到了一种使用Ipython.display.Image做到这一点的方法,但它并未在子图中绘制,而是在垂直方向上显示了所有gif。谁能帮助我如何在Ipython.display.Image
上应用子图with open('sample.gif','rb') as f:
display(Image(data=f.read(),format="png",width =150,height=150))