首页 > 解决方案 > 我试图在 python 中使用枕头模块打开图像

问题描述

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]

标签: pythonpython-3.ximagepython-imaging-library

解决方案



推荐阅读