0

I am trying to build a a python program to recognize the text from text containing objects in realtime. I was able to do OCR using tesseract from command line just to check if it works for static images or not. However, to use this in python we have to get use of pytesseract wrapper to use tesseract in python. I am following this Tutorial. But when i execute the script from the tutorial with sample image, it throws error like this:

Traceback (most recent call last):
  File "C:\Python27\tess1.py", line 4, in <module>
  print(pytesseract.image_to_string(Image.open('example_01.png')))
  File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 193, in 
  image_to_string
  return run_and_get_output(image, 'txt', lang, config, nice)
  File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 130, in 
  run_and_get_output
  temp_name, img_extension = save_image(image)
  File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 86, in 
  save_image
  image.save(input_file_name, format=img_extension, **image.info)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 1420, in save
  self.load()
  File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 193, in load
  d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 356, in 
 _getdecoder
  raise IOError("decoder %s not available" % decoder_name)
  IOError: decoder zip not available
  • Somehow the library is not able to decode `png` file format. – ZdaR Apr 06 '18 at 07:12
  • this looks like your case, try this: https://stackoverflow.com/questions/3544155/about-the-pil-error-ioerror-decoder-zip-not-available#answer-12359864 – Ricardo B. Apr 06 '18 at 07:24
  • Thanks for input @ZdaR, I tried with .jpg file and it is still giving same error. –  Apr 06 '18 at 07:25

0 Answers0