我需要使用 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"))
问题是只提取第一页。我怎样才能提取所有这些?
最佳答案
我能够通过如下调用方法 convert()
来解决同样的问题
image = Image.open(imagePath).convert("RGBA")
text = pytesseract.image_to_string(image)
print(text)
关于python - pytesseract 和 image.tif 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45292287/