java.lang.RuntimeException: Unsupported image format. May need to install JAI Image I/O package.
https://github.com/jai-imageio/jai-imageio-core
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:215) ~[tess4j-4.5.5.jar:4.5.5]
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:195) ~[tess4j-4.5.5.jar:4.5.5]
File ocrFile = new File("ocr.png ");
//使用OCR提取图片文字
Tesseract tesseract = new Tesseract();
//设置 Tesseract 数据文件的路径,如果不是默认路径的话
//tesseract.setDatapath("path_to_your_tessdata_folder");
try {
String result = tesseract.doOCR(ocrFile);
System.out.println(result);
} catch (TesseractException e) {
System.err.println(e.getMessage());
}
其他
java.lang.RuntimeException: Unsupported image format. May need to install JAI Image I/O package.
https://github.com/jai-imageio/jai-imageio-core
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:215) ~[tess4j-4.5.5.jar:4.5.5]
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:195) ~[tess4j-4.5.5.jar:4.5.5]