0

I'm trying to use tess4j to get a text from image, it's error:

"java.lang.RuntimeException: Unsupported image format. May need to install JAI Image I/O package."

Although, I added JAI-imageio-core to dependencies.

File imageFile = new File("myFilePath");
    ITesseract instance = new Tesseract();
    try {
        String result = instance.doOCR(imageFile);
        return result;
    } catch (TesseractException e) {
        System.err.println(e.getMessage());
        return "Error while reading image";
    }

1 Answers1

1

Had the same issue with payara, copy the jai image io lib to your java dir C:\ProgramFiles\Java\jdk {version}\jre\lib\ext

This worked for me.

Tested with Payara / Wildfly 11

Tinus Jackson
  • 3,397
  • 2
  • 25
  • 58