I'm facing an I/O bug when using large images as a TIFF file using javax.imageio
and JAI
.
Here is what I did:
Generate a random BufferedImage of type TYPE_CUSTOM with DataBufferInt encoding
Save the image as a TIFF file using javax.imageio or JAI
Read the image using javax.imageio or JAI
Compare the original image with the image saved/read
It turns out that everything works fine as long as the images dimensions are smaller than 31Kx31K ish, but if they are bigger then the top part of the image becomes different.
I looked online and I found this bug report. If I read it correctly, it should have been fixed since java 11.0.13, see this bug report. This bug appeared while I was using OpenJDF 11.0.2, so I tried using openjdk 11.0.14.1 2022-02-08 and openjdk 17.0.2 2022-01-18, but I still have the same issue. I don't have an exception as this bug report, so it's close but might not be related.
So my questions are:
- What am I not understanding correctly?
- Is there another better/safer way to handle TIFF images?