如何解决如何使用 wx.GIFHandler 的 SaveAnimation 方法?
我有一个生成 wx.Image
对象序列的 python 程序,我想用它们制作动画 GIF。我想看看我是否可以在 wxPython 中使用 wx.GIFHandler
来做到这一点,但我不知道要传递什么作为 images
参数。我希望我可以避免导入 PIL
或 cv2
,因为我已经导入了 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 SaveAnimation
,images
参数采用 ImageArray,但我能找到的唯一引用是在 C++ 代码 here 中,它似乎是对C++ wx.Image 对象的 C++ 数组。
我试过传递一个 python 列表、一个 wx.ImageList 和一个 numpy.array——它们似乎都不起作用。
预先感谢您提供的任何帮助!
TL;DR:如何创建 ImageArray
对象以传递给 SaveAnimation
?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。