【问题标题】:How to make image 2D and RGB如何使图像 2D 和 RGB
【发布时间】:2020-04-06 02:10:23
【问题描述】:

我使用iageio.imwrite() 时,我不断收到ValueError 说图像必须是2D(灰度、RGB 或RGBA)。我的输入数组的大小为 20,125,125。是这个问题吗?

imageio.imwrite('patterns.gif',u_e, format = 'GIF-PIL', fps = 100)

【问题讨论】:

标签: python gif animated-gif


【解决方案1】:

如果我理解正确,您想创建一个包含 20 帧(u_e 的第一维)的 .gif,每帧都是 125X125 灰度图像。如果是这种情况,我会使用mimsave 函数而不是imwrite:

imageio.mimsave('patterns.gif', u_e, format = 'GIF-PIL', fps = 100)

这是输出:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-28
    • 2013-06-19
    • 1970-01-01
    • 2016-08-16
    • 2020-08-23
    • 2021-08-20
    • 2014-05-26
    相关资源
    最近更新 更多