Unsupported image format on tesseract

47 views
Skip to first unread message

Laura Barroso

unread,
Dec 26, 2018, 10:41:19 AM12/26/18
to tesseract-ocr
Hello, I have being trying to work with tesseract with no success.
Here is my code:

ITesseract instance = new Tesseract();
ImageIO.scanForPlugins();
instance.setDatapath(imageFile.getParent());

try {

String result = instance.doOCR(imageFile);
System.out.println(result);

} catch (TesseractException e) {
LogUtil.logException(e);
}

And here is the pom.xml:

<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>${tess4J.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.media/jai_imageio -->
<dependency>
<groupId>com.sun.media</groupId>
<artifactId>jai_imageio</artifactId>
<version>${jai_imageio.version}</version>
<scope>system</scope>
<systemPath>${basedir}/lib/jai_imageio-1.1.jar</systemPath>
</dependency>

<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-core</artifactId>
<version>${jai-imageio-core.version}</version>
</dependency>


<dependency>
<groupId>com.github.jai-imageio</groupId>
<artifactId>jai-imageio-jpeg2000</artifactId>
<version>${jai-imageio-jpeg2000.version}</version>
</dependency>

It keeps throwing the exception: Caused by: java.lang.RuntimeException: Unsupported image format. May need to install JAI Image I/O package.
https://java.net/projects/jai-imageio/

Please advice
Thank you in advance.

Reply all
Reply to author
Forward
0 new messages