Aaron_Loves_Python
Aaron_Loves_Python

Reputation: 1

pyTesseract not outputing text from image

maybe someone could help me! When I run the following code

import pytesseract from pytesseract import image_to_string from PIL import Image import PIL

file = Image.open('/usr/local/Cellar/tesseract/4.1.0/share/tessdata/cap.png')
we_will = pytesseract.image_to_string(file)
print(we_will)

all that gets outputed is:

Process finished with exit code 0

which is no help. What am I doing wrong?

Upvotes: 0

Views: 228

Answers (1)

Mori Bellamy
Mori Bellamy

Reputation: 191

Sounds like we_will is the empty string. Try printing repr(we_will) to understand this idea more clearly.

IIRC, PyTesseract does this when it can't figure out what the text is inside the image. You can get the best results for a cropped image with a single-color background.

Upvotes: 1

Related Questions