pytesseract和image.tif文件

And*_*rés 2 python python-tesseract pytesser

我需要使用pytesseract将具有多个页面的image.tif转录为文本。我有下一个代码:

> From PIL import Image
> Import pytesseract
> Pytesseract.pytesseract.tesseract_cmd = 'C: / Program Files (x86) / Tesseract-
> OCR / tesseract '
> Print (pytesseract.image_to_string (Image.open ('CAMARA.tif'), lang = "spa"))
Run Code Online (Sandbox Code Playgroud)

问题在于只能提取冷杉页面。我如何提取所有这些?

小智 5

我可以通过调用方法来解决同样的问题convert(),如下

image = Image.open(imagePath).convert("RGBA")
text = pytesseract.image_to_string(image)
print(text)
Run Code Online (Sandbox Code Playgroud)