0
Traceback (most recent call last):
  File "C:\Python27\Stuff\imagetotext.py", line 9, in <module>
    i = pytesseract.image_to_string(img)
  File "C:\Python27\lib\site-packages\pytesseract\pytesseract.py", line 143, in
image_to_string
    if len(image.split()) == 4:
AttributeError: 'PixelAccess' object has no attribute 'split'

So, I'm really not sure what to do with this. https://gyazo.com/63c6439285d629c72e9076c1b4a29a42 is test.png. I've tried a lot.

try:
    import Image
except ImportError:
    from PIL import Image
import pytesseract

img = Image.open('test.bmp').load()
#img.load()
i = pytesseract.image_to_string(img)
print i

I've read it might be a bug with PIL, but I just have no idea.

1 Answers1

0
try:
    import Image
except ImportError:
    from PIL import Image
import pytesseract

img = Image.open('test.bmp')
img.load()
i = pytesseract.image_to_string(img)
print i
RAVI
  • 3,143
  • 4
  • 25
  • 38