Trying to OCR a jpeg but getting [Error 3221225477]?
Created by: Helyux
Hello, any Idea what the following error means? i didn't find anything except this which didn't help me narrow it down.
Code Snippet:
# Read in pdf and Convert to jpeg #
image_pdf = Image(filename=filepath, resolution=350)
#ONLY GET THE FIRST SITE FROM THE PDF#
extractedfirstsite = image_pdf.sequence[0]
firstimage = Image(image=extractedfirstsite)
image_jpeg = firstimage.convert('jpeg')
# Append Image Blobs to List #
for img in image_jpeg.sequence:
img_page = Image(image=img)
req_image.append(img_page.make_blob('jpeg'))
# OCR every image blob and append found text to List #
for img in req_image:
txt = tool.image_to_string(
PI.open(io.BytesIO(img)),
lang=lang,
builder=pyocr.builders.TextBuilder()
)
final_text.append(txt)
The corresponding Error:
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyocr\tesseract.py", line 367, in image_to_string
raise TesseractError(status, errors)
pyocr.error.TesseractError: (3221225477, b'')
I tested the general functionality of tesseract and it works as expected.
C:\>tesseract test.jpg out
Tesseract Open Source OCR Engine v4.00.00alpha with Leptonica
Warning. Invalid resolution 0 dpi. Using 70 instead.
Im running:
- Windows 10 (64 Bit)
- Python 3.6.5 (32 Bit)
- Tesseract (unofficial installer for windows for Tesseract 4.00-dev)
- ImageMagick 6.9.9-40 Q8 (32 Bit)
- Wand and PIL (respectively 32 Bit)
Any help would be appreciated.