2012.03.27 15:22 "[Tiff] Multiplanar image", by Jorge Martin

2012.03.30 15:32 "[Tiff] writing PLANAR_CONFIG SEPARATE images", by Richard Nolde

On 03/29/2012 11:00 AM, tiff-request@lists.maptools.org wrote:

In the case we assume all the planes are contiguous, one over the other, in the buffer that we send to the function TIFFWriteEncodedStrip. Have we need to insert any kind of mark between each plane or the function is smart enough to recognise the different planes with the PlanarConfiguratio Tag?

I'm in the middle of something so I cannot give details here, but look at the function writeBufferToSeparateStrips and the code it calls in the tiffcrop.c source. Tiffcrop processes all documents internally in a buffer as interleaved contiguous samples for all planes so it has to export them back to separate planes for your case. The routine called by the writeBufferToSeparateStrips after

  extractContigSamplesToBuffer(obuf, src, nrows, width, s, spp, bps,


  TIFFWriteEncodedStrip(out, strip++, obuf, stripsize)

  You might also find the code that you want in tiffcp, but it is limited

in regard to the samples per pixel that it handles for some image configurations.

My notes for the writeBufferToSeparateStrips function contain the following. The second sentence is the key to PLANAR_CONFIG SEPARATE. You have to build the proper buffer to pass the right samples to be written into the each strip so that this requirement is met. That is what my extract routine does.

/* Libtiff internals seem to depend on all data for a given sample