imageio - ValueError: Could not find a format to read the specified file in mode 'i'

imageio - ValueError: Could not find a format to read the specified file in mode 'i'

我有一系列 SVG 图片(从 matplotlib 生成),我想将它们组合成 GIF 图片。

自从我读到这个 ​​question,我尝试了 imageio,但它在 imread(str(i)+'.svg') 部分引发了 ValueError: Could not find a format to read the specified file in mode 'i'。如何解决这个问题?

SVG 是一种矢量格式,imageio 不支持它:键入 imageio.help() 以显示所有支持的格式。

您需要先使用 svg 到位图转换器(将图像栅格化,这样您就可以选择图像的质量)。 或者更好的是,看看是否有制作 SVG 动画的本机方法(google 找到一些关于这个主题的教程)。