Closed ghost closed 9 years ago
Hi,
I am trying to decode a jbig2 file to a png file. But the code is slower especially while reading the image. Could you suggest me performance improvements so that execution is faster.Currently it takes 485ms.I want it to be reduced to under 150ms. I am posting the code that I use to decode.
Iterator<?> readers = ImageIO.getImageReadersByFormatName("JBIG2"); //takes about 80ms
ImageReader reader = (ImageReader) readers.next(); Object source = fis; //reading the jbig2 file from the disk using FileInputStream fis ImageInputStream iis = ImageIO.createImageInputStream(source); reader.setInput(iis, true); ImageReadParam param = reader.getDefaultReadParam();
Image image = reader.read(0, param); // takes about 150ms
BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_BYTE_BINARY);
Graphics2D g2 = bufferedImage.createGraphics(); g2.drawImage(image, null, null);
Eagerly waiting for your reply. Thank You
Please open a new issue as this has nothing to do with the existing.
If the typical prediction feature is enabled (
TPGDON
is1
) andLTP
is set to1
the algorithm defined in ITU-T Rec. T.88, 6.2.5.7 Decoding the bitmap describes that the current row should receive all pixels of the row immediately above. That won't work if the current row is the first (top) row of the page.