TIFF PlanarConfiguration: Trace Sample Layout Before Comparing a Drone Raster
Compare contiguous and separate sample organization using constructed byte rows, while keeping TIFF storage layout separate from band meaning and image quality.

Identify the comparison boundary before calling a band mismatch
A multiband drone raster can contain the expected sample values while arranging them differently in storage. If a diagnostic treats every group of three bytes as one pixel without confirming the organization, it can produce plausible but incorrect tuples. Before blaming a band swap or a changed export, identify what the supplied buffer represents. Record whether it came from a file decoder, a band-oriented API, or a custom memory extract. That boundary matters because a high-level reader may already have reorganized the values for the caller.
This tutorial compares two constructed representations of one row with two pixels and three eight-bit samples per pixel. The labels A, B, and C are assigned for the exercise; they are not verified red, green, and blue channels from a NiVO product. No TIFF is opened and no original image is changed. The useful desk-review outcome is a clear explanation of how two differently organized byte sequences can represent the same declared pixel tuples. Sample meaning, compression, spatial reference, and project acceptance still require separate evidence.
Read PlanarConfiguration without confusing it with sample type
LibTIFF defines PlanarConfiguration as tag 284, with value 1 for contiguous organization and value 2 for separate planes. GDAL describes PIXEL interleaving as gathering all band values for a spatial block together, corresponding to TIFF contiguous organization. BAND interleaving uses a separate tile or strip for each band in a spatial block. These descriptions concern organization. They do not say that every three-sample image is RGB, that its samples are unsigned bytes, or that its bands have a particular analytical meaning.
Keep PlanarConfiguration alongside SamplesPerPixel, BitsPerSample, SampleFormat, and the relevant color or band interpretation when investigating a real file. Knowing where the next component sits is different from knowing how to interpret its bits. The exercise below fixes all components at one byte and assumes an already resolved row, so byte order within a multi-byte sample is outside its scope. It also avoids assuming that an entire real TIFF consists of one flat image-sized byte array. Actual strips, tiles, offsets, compression, and directory selection need an appropriate file reader.

Product context only; this photograph does not depict the constructed examples in this article.
Trace two explicit row layouts with the same pixel values
For the constructed contiguous row, the bytes are 10, 20, 30, 40, 50, 60. Reading the three samples of pixel zero first produces the tuple 10, 20, 30, followed by pixel one with 40, 50, 60. The constructed separate row instead concatenates the row for A, then B, then C: 10, 40, 20, 50, 30, 60. The same pixel tuples are recovered only when the indexing follows that declared arrangement. No visual color interpretation is needed to establish the equality of these teaching tuples.
Run the following Python function on the two byte strings. It checks the selected layout, positive bounded dimensions, exact sample count, and immutable bytes input before calculating indices. The width and sample-count limits are local demonstration limits, not TIFF format maxima. Both calls should return the same list of two tuples. If the separate representation is deliberately read as contiguous, the values remain within the byte range but the grouping becomes wrong. Range checks alone therefore cannot establish that the intended samples were associated with the intended pixel.
def row_pixels(raw, width, samples, planar):
if type(width) is not int or not 1 <= width <= 4096:
raise ValueError("Unsupported teaching row width")
if type(samples) is not int or not 1 <= samples <= 16:
raise ValueError("Unsupported teaching sample count")
if type(planar) is not int or planar not in (1, 2):
raise ValueError("Expected contiguous=1 or separate=2")
if not isinstance(raw, bytes) or len(raw) != width * samples:
raise ValueError("Expected exact decoded eight-bit row bytes")
def index(pixel, sample):
return pixel * samples + sample if planar == 1 else sample * width + pixel
return [tuple(raw[index(p, s)] for s in range(samples)) for p in range(width)]
# Constructed row buffers, not a TIFF file or a library scanline result.
contiguous = bytes([10, 20, 30, 40, 50, 60])
separate = bytes([10, 40, 20, 50, 30, 60])
print(row_pixels(contiguous, 2, 3, 1))
print(row_pixels(separate, 2, 3, 2))Respect the actual decoder’s buffer contract
The separate teaching input joins three sample-plane rows into one memory buffer for explanation. It is not presented as the direct output of one LibTIFF scanline call. LibTIFF documents that TIFFReadScanline uses its sample parameter for separate planes, and that the supplied buffer must hold an entire scanline as determined by the library size function. This distinction prevents a common mistake: treating a conceptual diagram of all planes as if it described every decoder API return value. Read the contract of the actual function before applying any manual index calculation.
For a real investigation, preserve the file and identify the directory, row or spatial block, sample selection, and API used to obtain the values. Determine whether the reader has already decompressed or converted the data. Record that interpretation before comparing the output with another tool. This tutorial does not call LibTIFF or GDAL and supplies no evidence about an installed version. It demonstrates the indexing boundary so that a reviewer can ask a precise question about an actual decoder rather than assuming that all returned buffers mirror the file’s organization.
Separate storage organization from delivery decisions
A different PlanarConfiguration does not by itself establish that an image has changed numerically. Compare corresponding decoded values at identified pixels and bands using suitable readers, then examine the other required metadata. Conversely, equal values in the tiny example do not establish equivalence of two real files. An actual export may also change sample type, nodata handling, band order, compression settings, or spatial metadata. Keep each comparison explicit. A storage-layout explanation should resolve one possible cause of a discrepancy without becoming an unsupported claim about the complete delivered raster.
Avoid recommending a blanket interleave conversion merely because one organization is familiar. GDAL documents different creation options and notes compatibility and compression considerations; the appropriate choice depends on the intended receiving workflow. Establish the requirement and test the actual derivative if a conversion is necessary. Preserve the original alongside the export record. Neither the row exercise nor the cover diagram measures access speed, file size, or image quality, and neither supports a claim that one organization is universally better for every drone mapping use.
Deliver the layout evidence with a reproducible comparison
A useful handoff finding identifies the received file, the relevant directory and samples, the reported PlanarConfiguration, and the reader’s output contract. Include a small identified comparison of decoded values if that check was actually performed. State which checks remain outside the result, including spatial placement and analytical suitability. If a custom diagnostic produced the wrong grouping, correct the diagnostic and repeat its comparison without rewriting the original TIFF to match the mistaken assumption. Retain the earlier finding as part of the investigation history rather than silently replacing it.
For a NiVO-related raster discussion, the practical gain is a clear distinction between value interpretation and value organization. Reviewers can explain how the intended samples become pixel tuples before deciding whether a genuine numerical or semantic discrepancy remains. The constructed example is deliberately small enough to inspect by hand and reproduce with Python. Carry its lesson into the actual reader contract, then continue the separate band, validity, spatial-reference, and project-content checks needed for the deliverable. A successful indexing demonstration is useful evidence about the method, not a measured survey result.



