I am using JAI to read/write multi-page TIFFs containing different type of images (different sizes, different compression methods) and I have to read the file, change a few values in the TIFF headers of the pages and write these headers back without changing image content/compression.
Though I am able to read all pages and headers, modify the headers and re-write the whole TIFF, I am concerned about the time needed for recompression, especially when the "main" image is already JPEG-compressed, multiple read/write would loose more and more data.
I already thought about two things:
- Write specific header content to mark positions in file and hack into it to change
- Write a JNI wrapper on top of C libtiff (but I would rather not)
If possible, I would prefer to do it all with JAI.