Cha*_*ell 32 python python-imaging-library pillow
我有一个导入Pillow库的python文件.我可以打开图像
Image.open(test.png)
Run Code Online (Sandbox Code Playgroud)
但是如何关闭该图像呢?我没有使用Pillow来编辑图像,只是为了显示图像并允许用户选择保存或删除它.
Mor*_*app 56
你也可以用一个块来做:
with Image.open('test.png') as test_image:
do_things(test_image)
Run Code Online (Sandbox Code Playgroud)
使用示例Image.close():
test = Image.open('test.png')
test.close()
Run Code Online (Sandbox Code Playgroud)