【发布时间】:2017-11-13 09:10:54
【问题描述】:
我想使用 PIL.Image.open() 读取图像。但我的图像位于不同的路径中。 以下是我的python脚本路径
"D:\YY_Aadhi\holy-edge-master\hed\test.py"
以下是我保存图片文件的路径。
"D:\YY_Aadhi\HED-BSDS\test\2018.jpg"
from PIL import Image
'''some code here'''
image = Image.open(????)
我应该如何填写问号才能访问图像文件。
【问题讨论】:
-
你真的不只是尝试
Image.open("D:\YY_Aadhi\HED-BSDS\test\2018.jpg")吗? -
那么您是否尝试过仅填充路径?
-
pillow.readthedocs.io/en/3.1.x/reference/… 文档要求提供文件路径。所以指定图像的路径,它会工作
-
需要转义路径:
Image.open("D:\\YY_Aadhi\\HED-BSDS\\test\\2018.jpg")orImage.open(r"D:\YY_Aadhi\HED-BSDS\test\2018.jpg")
标签: python python-3.x python-imaging-library pillow