正在尝试使用pytesseract
从类型为'PIL.PpmImagePlugin.PpmImageFile'
的图像中提取文本。代码和错误如下
from pdf2image import convert_from_path
pages = convert_from_path('D:/pdf_csv/HealthCare/eRDS - ML/eRDS - ML/2001468/2001468,69,70.pdf',poppler_path='C:/Users/Hp/poppler-0.68.0/bin')
text = pyt.image_to_string(Image.open(pages[0]), lang='eng')
我得到的错误:
^{pr2}$或者有什么方法可以将PpmImageFile转换成jpg或png格式
将
fmt='jpeg'
或fmt='png'
添加到函数调用中,以从pdf2image获取非PPM图像。在在你的例子中,改变
到
^{pr2}$相关问题 更多 >
编程相关推荐