conversion from RGB to l not supported
我想将图片从RGBA转为L,但是会出现上述报错
具体代码如下:
```python
import pytesseract
from PIL import Image
import numpy as np
im = Image.open("D:\captcha.png")
im = im.convert("l")
threshold = 50
array = np.array(im)
array = np.where(array > threshold, 255, 0)
im = Image.fromarray(array.astype("unit8"))
```