在Python中显示来自控制台的图像 [英] Showing an image from console in Python
本文介绍了在Python中显示来自控制台的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从Python控制台显示 .jpg
或 .gif
图像的最简单方法是什么?
What is the easiest way to show a .jpg
or .gif
image from Python console?
我有一个Python控制台程序正在检查包含本地存储图像链接的数据集。我应该如何编写脚本以便显示图像弹出图形窗口?
I've got a Python console program that is checking a data set which contains links to images stored locally. How should I write the script so that it would display images pop-up graphical windows?
推荐答案
使用awesome 枕头库:
Using the awesome Pillow library:
>>> from PIL import Image
>>> img = Image.open('test.png')
>>> img.show()
这将在默认图像查看器中打开图像。
This will open the image in your default image viewer.
这篇关于在Python中显示来自控制台的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文