2

I need to use pytesseract to extract text from this picture: enter image description here

However, i used pytesseract. It wont work.Here is my code:

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

print(pytesseract.image_to_string(Image.open('1.png')))
Hasturkun
  • 35,395
  • 6
  • 71
  • 104
GMB
  • 21
  • 1
  • 3
  • Can you provide the error you get? – Chobeat Jul 11 '17 at 07:07
  • Make sure that you have downloaded tesseract and setup your system to run that properly. pytesseract depend on tesseract – jlaur Jul 11 '17 at 07:41
  • Yes, i have downloaded tesseract and its running properly. Actually its printing nothing and sorry for said error. – GMB Jul 11 '17 at 08:18

1 Answers1

0

you have to install textract using this we can extract text from any extension.

# some python file
import textract
text = textract.process("path/to/file.extension")

you can provide file as image or pdf or any docs. for your code

text = textract.process("1.png")
ammy
  • 618
  • 1
  • 5
  • 13