2016.10.24 14:54 "Re: [Tiff] Question regarding tag StripOffsets when there is only one strip", by Recursive

2016.10.24 06:41 "[Tiff] Question regarding tag StripOffsets when there is only one strip", by Recursive

Dear all,

yesterday, I have studied the TIFF specification mentioned on LibTiff's home page (http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf). That left me with a few questions. The first of them:

One one hand, the value of a StripOffsets tag is the offset to a table which in turn contains the offset for every strip of the image. This is logic and understandable.

On the other hand, from page 15 of the specification mentioned above:

"Value/Offset

To save time and space the Value Offset contains the Value instead of pointing to the Value if and only if the Value fits into 4 bytes. If the Value is shorter than 4 bytes, it is left-justified within the 4-byte Value Offset, i.e., stored in the lowernumbered bytes. Whether the Value fits within 4 bytes is determined by the Type and Count of the field."

Now, if having LONG values for the offsets, if there is only one strip in the image, its offset would fit directly into the value field of the respective tag, so actually there is no need for a table of offsets. In that sense, I would have to put the offset of the strip directly into the value field of tag 273 if and only if there is exactly one strip in the image, but I would have to make a table containing the strip offsets and put the offset to that table into the value field of tag 273 if there is more than one strip.

To make things worse, there could be SHORT values for offsets as well. The situation would be like above, except that now two offsets would fit into the value field of tag 273 directly.

I just would like to know if I got this right, i.e. if I really need to implement a special treatment for images with only one strip (or two strips, depending on the type of the offsets). Of course, there are analogies to other tags (StripByteCounts, TileOffsets and so on), so this question is generally about how to handle tables when there is only one table entry.

Thank you very much,

Recursive