2015.02.11 01:56 "[Tiff] Interleaved write of multiple TIFF frames", by Paavo

2015.02.11 06:25 "Re: [Tiff] Interleaved write of multiple TIFF frames", by Paavo

On Wed, 11 Feb 2015, paavo@osa.pri.ee wrote:

Is it possible to write multiple TIFF frames at the same time with libTIFF? I am facing a task of writing TIFF files which could potentially contain multiple multi-gigabyte image frames, with pixel data arriving piecewise in an interleaved fashion and I do not want to collect and hold all these gigabytes in memory buffers.

While libtiff in general is thread safe, I don't believe that it is thread safe to try to use the same libtiff handle via multiple threads. Libtiff reading/writing is rather ordered and the current state is stored in the libtiff handle without any concurrency control.

Sorry, maybe I was not clear enough. I did not have parallel multithreading in mind (which clearly would not work), rather incremental interleaved population of different IFD-s with data.

To go really fast, you would want to avoid compression and pre-compute the TIFF IFDs in advance (based on known data sizes) as well as do your own data writing with position-independent APIs like pwrite() or mmap(). I am not sure if this is possible within the context of libtiff or if you would have to entirely create your own TIFF writer.

Yes, that's what I am trying to figure out - is using libTIFF a solution or a problem!

Cheers
Paavo