如何将 TKinter PhotoImage 保存为 .GIF? [英] How can I save TKinter PhotoImage to .GIF?

查看:35
本文介绍了如何将 TKinter PhotoImage 保存为 .GIF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以仅使用 Python 和 tkinter 将 tkinter PhotoImage 保存为 .gif(或任何其他图像扩展名)吗?

Can I save a tkinter PhotoImage as .gif (or any other image extension) using only Python and tkinter?

推荐答案

假设 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).

这篇关于如何将 TKinter PhotoImage 保存为 .GIF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆