AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2003.02.26 17:50 "newbie", by John Carter
2003.02.27 14:23 "Re: newbie", by Greg Roberts

2003.02.27 14:23 "Re: newbie", by Greg Roberts

Hi,

I'm new to the TIFF format as well, so ignore me if this makes little to no sense.

  1. Tags not defined in the spec are common, and are defined on page 8 of the spec. These private tags can be reserved by organizations so as to avoid a tag having two interpretations by different applications. Unless you're dumping tags or know specifically which private tag you're looking for, you should just skip over any unrecognized tags. (And if it's completeness you're after, you'll need to support thousands of private tags :)
  2. If you're trying to read the actual image data, it is stored either in strips or in tiles. There will be a set of N strips, each of which is ImageWidth * RowsPerStrip "pixels" in area. A tile is basically the same, except not necessarily ImageWidth wide, its dimensions are given instead by tags 322 and 323.

For each strip (or tile) you need to read a set of "pixels" from the strip offset (tile offset) which will be given in the StripOffsets tag (273). Each "pixel" is actually a set of bytes, the number of which depends on the BitsPerSample and SamplesPerPixel. For example, if SamplesPerPixel were 3 and BitsPerSample were 8,8,8 you would need to read 3 bytes for each "pixel" in the strip. The first byte you read would be the red component, the second byte green and the third blue.

Also keep in mind that the data read from the strip offsets is often compressed.

Hope this helps,
    Greg Roberts