如何使用 wx.GIFHandler 的 SaveAnimation 方法?

问题描述

我有一个生成 wx.Image 对象序列的 python 程序,我想用它们制作动画 GIF。我想看看我是否可以在 wxPython 中使用 wx.GIFHandler 来做到这一点,但我不知道要传递什么作为 images 参数。我希望我可以避免导入 PILcv2,因为我已经导入了 wx,并且它似乎具有执行此操作的内置功能

这是 API 参考:

SaveAnimation(self,images,stream,verbose=True,delayMilliSecs=1000)¶

    Save the animated gif.

    Parameters

            images (ImageArray) – The image array object which is to be affected by this operation.

            stream (wx.OutputStream) – Opened output stream for writing the data.

            verbose (bool) – If set to True,errors reported by the image handler will produce LogMessages

            delayMilliSecs (int) – How long,in milliseconds,to wait between each frame.

    Return type
        bool

    Returns
        True if the operation succeeded,False otherwise.

根据 API reference for wx.GIFHandler SaveAnimationimages 参数采用 ImageArray,但我能找到的唯一引用是在 C++ 代码 here 中,它似乎是对C++ wx.Image 对象的 C++ 数组。

我试过传递一个 python 列表、一个 wx.ImageList 和一个 numpy.array——它们似乎都不起作用。

预先感谢您提供的任何帮助!

TL;DR:如何创建 ImageArray 对象以传递给 SaveAnimation

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)