识别图片内容报错:javax.imageio.IIOException: Failed to read a chunk of type 1933723988

  • Post author:
  • Post category:java


识别图片内容报错:

14:42:17.089 [main] ERROR net.sourceforge.tess4j.Tesseract – Error reading PNG metadata

javax.imageio.IIOException: Error reading PNG metadata

at com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:796)

at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1256)

at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1614)

at javax.imageio.ImageReader.readAll(ImageReader.java:1066)

at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:226)

at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:194)

at tools.image.ImageUtil.getString(ImageUtil.java:31)

at tools.image.ImageUtil.main(ImageUtil.java:40)

Caused by: javax.imageio.IIOException: Failed to read a chunk of type 1933723988

at com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:790)

… 7 common frames omitted

javax.imageio.IIOException: Error reading PNG metadata

下面左边是刚开始使用的图片,图片是自己裁剪过的,识别的时候报了上面的错,查看图片发现图片上的字很模糊,怀疑是这个导致的报错,后来把图片转换为灰度图像,再识别就可以了




版权声明:本文为hxy199421原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。