from PIL import Image
image1 = Image.open('img1.jpg', "rb")
image1.show()
使用此命令
我得到了下面的错误,我试图用开放模式如rb打开,但它提出了一个坏模式的值错误
Traceback (most recent call last):
File "C:\Users\Gowtham\Desktop\Quarantine python\Image manipulation\img.py", line 3, in <module>
image1 = Image.open('img1.jpg',"rb")
File "C:\Users\Gowtham\Anaconda3\lib\site-packages\PIL\Image.py", line 2599, in open
raise ValueError("bad mode %r" % mode)
ValueError: bad mode 'rb'
[Finished in 1.047s]
根据[ReadTheDocs.Pillow]: PIL.Image.open(fp, mode='r')(强调是我的):
可能,保留此参数只是为了向后兼容(或与其他open类似函数保持一致)
将代码(行)更改为:
相关问题 更多 >
编程相关推荐