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

2015.02.11 03:58 "Re: [Tiff] Interleaved write of multiple TIFF frames", by Bob Friesenhahn

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.

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.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/