Closed jnankin closed 8 years ago
I was writing over an existing file which was generating a corrupt file.
Here is some code using the JAI (1.3.1) Github release:
TIFFImageReader imageReader = getTiffImageReader(); imageReader.setInput(is); TIFFImageWriter imageWriter = getTiffImageWriter(); ImageOutputStream ios = ImageIO.createImageOutputStream(new File(outputFilename)); imageWriter.setOutput(ios); TIFFImageWriteParam writeParam = (TIFFImageWriteParam)imageWriter.getDefaultWriteParam(); writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); writeParam.setCompressionType("CCITT T.6"); imageWriter.prepareWriteSequence(null); int pageNumbers = imageReader.getNumImages(true); for (int i = 0; i < pageNumbers; i++){ BufferedImage currentPage = imageReader.read(i); IIOImage iiom = new IIOImage(currentPage, null, null); imageWriter.writeToSequence(iiom, writeParam); } imageWriter.endWriteSequence(); imageWriter.dispose(); ios.flush(); ios.close();
When I run an input file through here that is roughly 55kb, it bloats it to 3.7mb. The file size does not change if I remove writeParam from imageWriter.writeToSequence.
Why is the file not lower under compression?
Does this resolved?
Here is some code using the JAI (1.3.1) Github release:
When I run an input file through here that is roughly 55kb, it bloats it to 3.7mb. The file size does not change if I remove writeParam from imageWriter.writeToSequence.
Why is the file not lower under compression?