且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将 TKinter PhotoImage 保存为 .GIF?

更新时间:2023-12-02 18:37:34

假设 photo 是保存图像的变量,你应该可以说:

Assuming photo is the variable holding your image, you should be able to just say:

photo.write('some_name.gif', format='gif')

我找不到支持哪些格式的列表,但我认为列表非常有限(不过我可以确认 gif 对我有用).

I couldn't find a list of what formats are supported, but I think the list is really limited (I can confirm that gif worked for me though).