2003.04.29 17:58 "RE: Newbie Question (StripOffsets/StripByteCount)", by Harring Figueiredo
Thanks for the reply.
I understand the offset concept when the data does not fit on the LONG value field ( count * size_of_type > 4) means that the value holds the offset. In fact, I already have a Java TIFF dump that matches exactly with the C counterpart ( except that mine still does not handle multipage).
Thanks again for clarifying how to get the strip data. I will do the way you are saying.
--- "Belshan, James (E52)" <firstname.lastname@example.org> wrote:
Hope I don't say anything that's incorrect... But here goes.
How you interpret the ValueOffset (VO) field depends on how much and what type of numbers are in the tag. If all of the tag data will fit in the VO field, it puts it there, otherwise VO is a LONG pointer to the data location. If that's the case, then you would move to that point in the file, and read the number and type of Values specified in the tag. In your case, since the StipOffset and StripByteCount tags only have 1 value, it fits in the VO field. So you would move to byte 8 in the file and read 11544 bytes of data to get your image.
If you had more than 1 strip, (say 5 strips) then StripOffsets would have 5 values (and so wouldn't fit in the VO field), and the StripOffsets VO would point you where to go to read 5 LONG offsets. You would then go to EACH of the 5 byte locations and read the proper # of bytes for that strip. StripByteCounts would also have 5 values to tell how long each of the 5 strips are.
Page 16 of the TIFF Rev 6.0 tells you that the VO field is 4 bytes long, so it will fit 2 SHORTS or 1 LONG. An example of a tag that doesn't fit in the VO field is the RATIONAL resolutions that tiffdump is showing you. RATIONALS are 8 bytes, and so don't fit in the VO field. tiffdump is actually following an offset in the VO, and reading 8 bytes to make the RATIONAL.
Hope this helps,
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.