python PIL image.open()错误

时间:2017-08-05 04:51:02

标签: python python-imaging-library

您好我使用PIL打开图片但是有这样的错误; 回溯(最近一次调用最后一次):

  File "/Users/minsw0810gmail.com/Desktop/GUIAccidentAlarm.py", line 
142, in <module>
   filename1 = Image.open('횡단보도상_100x100.jpg', "rb")
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/PIL/Image.py", line 2462, in open
    raise ValueError("bad mode %r" % mode)
ValueError: bad mode 'rb'
[Finished in 0.8s with exit code 1]
[shell_cmd: python -u 
"/Users/minsw0810gmail.com/Desktop/GUIAccidentAlarm.py"]
[dir: /Users/minsw0810gmail.com/Desktop]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

*횡단보도상_100x100.jpg是韩国人 我的代码是

filename1 = Image.open(&#39;횡단보도상_100x100.jpg&#39;)

1 个答案:

答案 0 :(得分:2)

Image.open()仅支持“r”作为模式参数,并为其他所有内容抛出异常。

以下是该文档对此参数的说明:

  

模式 - 模式。如果给出,则该参数必须为“r”。

有关详细信息,请访问以下链接:

http://pillow.readthedocs.io/en/3.4.x/reference/Image.html#PIL.Image.open

我希望这可以帮到你。

相关问题