如何在python中插入图像

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16442923/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 22:37:17  来源:igfitidea点击:

How to insert an image in python

pythonimportinsert

提问by Daniel Turner

how do you import or insert an image using python.Basically I want to know how to import an image and how to select the file and folder its in using python.

你如何使用python导入或插入图像。基本上我想知道如何导入图像以及如何使用python选择文件和文件夹。

回答by Sameer H. Ibra

Install PIL(Python Image Library) :

安装 PIL(Python 图像库):

then:

然后:

from PIL import Image
myImage = Image.open("your_image_here");
myImage.show();