2
votes

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:

  1. Write specific header content to mark positions in file and hack into it to change
  2. 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.

1

1 Answers

0
votes

I couldn't find any proper way of doing that, except manually reading the file, rewriting image data as read and patching through the TIFF fields positions/offsets ...