Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I merge the attached two tiff file into one tiff, but the target file is corrupted. #65

Open
songshiliang07 opened this issue Jun 20, 2019 · 1 comment

Comments

@songshiliang07
Copy link

2011-XC1-00001-301.zip

The following code is:
ImageWriter writer = ImageIO.getImageWritersByFormatName("TIFF").next();
ImageOutputStream output = ImageIO.createImageOutputStream(_file);
writer.setOutput(output);
writer.prepareWriteSequence(null);
for (FileWrapper file : files) {
ImageInputStream iis = ImageIO.createImageInputStream(file.file);
ImageReader reader = ImageIO.getImageReaders(iis).next();
reader.setInput(iis);
int numPages = reader.getNumImages(true);
for (int i = 0; i < numPages; i++) {
IIOImage iioImage = reader.readAll(i, null);
writer.writeToSequence(iioImage, null);
}
reader.dispose();
iis.close();
}
writer.endWriteSequence();
writer.dispose();
output.close();

@songshiliang07
Copy link
Author

When I try to open and read the target merged file, the exception happened.
javax.imageio.IIOException: Quantization table 0x01 was not defined at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImage(Native Method) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1247) at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1050) at com.github.jaiimageio.impl.plugins.tiff.TIFFJPEGDecompressor.decodeRaw(TIFFJPEGDecompressor.java:226) at com.github.jaiimageio.plugins.tiff.TIFFDecompressor.decode(TIFFDecompressor.java:2583) at com.github.jaiimageio.impl.plugins.tiff.TIFFImageReader.decodeTile(TIFFImageReader.java:1144) at com.github.jaiimageio.impl.plugins.tiff.TIFFImageReader.read(TIFFImageReader.java:1414) at javax.imageio.ImageReader.readAll(ImageReader.java:1066)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant