2012.07.11 20:52 "[Tiff] Doubts about Strip and Tile Oriented read/write TIFF files", by Jorge Martin

2012.07.12 11:17 "Re: [Tiff] Doubts about Strip and Tile Oriented read/write TIFF files", by Joris Van Damme

Jorge,

Yes, you are right. When you read the las strip, you only have to read 10 lines, is this correct? And when you are writting this image, what you have to do when writes the last strip?

I've quickly looked it up, so as to make sure I don't give you wrong information based on my bad memory...

Quote from the specification, Section 15, Introduction, Padding:

<quote>

Boundary tiles are padded to the tile boundaries. For example, if TileWidth is 64

and ImageWidth is 129, then the image is 3 tiles wide and 63 pixels of padding must be added to fill the rightmost column of tiles. The same holds for TileLength

and ImageLength. It doesn’t matter what value is used for padding, because good TIFF readers display only the pixels defined by ImageWidth and ImageLength and ignore any padded pixels. Some compression schemes work best if the padding is accomplished by replicating the last column and last row instead of padding with 0’s.

<end quote>

So I do seem to remember the tiling situation correctly, except that my preference for repetition of last valid color isn't as uniquely mine as I remembered it, it is instead actually a recommendation in the specification.

As is usual in the TIFF specification, due to its emphasis on artificial 'subgroups' of TIFF rather then a correct emphasis on the independent different steps and options in the encoding and decoding process, one finds information in the most unlikely of places. Information about the strip situation is in Section 3: Bilevel images, Location of the data, RowsPerStrip:

<quote>

The number of rows in each strip (except possibly the last strip.)

For example, if ImageLength is 24, and RowsPerStrip is 10, then there are 3 strips, with 10 rows in the first strip, 10 rows in the second strip, and 4 rows in the

third strip. (The data in the last strip is not padded with 6 extra
rows of dummy
data.)
<end quote>

So indeed I remembered correctly, though I probably explained badly. The point is simply, when using strips rather then tiles, there is no padding. (LibTiff may or may not require full-strip-sized buffers when encoding and give you a full-strip-sized buffer when decoding, I don't know, but in any case the method of padding that is applied to this irrelevant part of the buffer for the last strip is unlikely to have any impact in either direction.)

Best regards,

Joris Van Damme
AWare Systems