I create some app which use Tessaract and before use OCR I use Leptutils to remove horizontal lines from image. In Eclipse all works fine, but when I export in jar file, programm stucks on ImageIO.write. This function is done under its own threath. When I use these operations under main threath, all works fine. What is wrong? Here is some code:
PDFRenderer pdfRenderer = new PDFRenderer(document);
int lpp = document.getNumberOfPages();
Cikls=0; Aplis =1;
ST_OCR1(lpp); //Run process monitor
Pix bild = null;
Pix bild1 = null;
for(int i = 0; i < lpp; ++i) {
Cikls=i;
BufferedImage image = pdfRenderer.renderImageWithDPI(i, dpi, ImageType.GRAY);
try { bild =LeptUtils.convertImageToPix(image); logger.info("convertImageToPix");}
catch (IOException e) {logger.info("Exeption convertImageToPix");}
bild1 = LeptUtils.removeLines(bild);
try {image = LeptUtils.convertPixToImage(bild1); logger.info("convertPixToImage");}
catch (IOException e) {logger.info("Exeption convertPixToImage");}
try {ImageIO.write(image, Jpg, new File(Cels + "\\Temp\\"+ "p"+i+"."+Jpg)); logger.info("ImageIO.write");} // <- Here programm stuck!!!!!!!!!
catch (IOException e) { logger.info("Exeption ImageIO.write");}
}
//release Pix resource
PointerByReference pRef = new PointerByReference();
pRef.setValue(bild.getPointer());
Leptonica1.pixDestroy(pRef);
pRef.setValue(bild1.getPointer());
Leptonica1.pixDestroy(pRef);
document.close();