Menu

#36 OpenTiff Strip Chopping Affecting Keys

open
nobody
Accessor (25)
3
2002-08-26
2002-08-26
Daniel Rupe
No

From an email from Ricky: OpenTiff, by default, does "strip chopping" to all files with a single
uncompressed strip of image data opened in ReadOnly mode (This is apparently done to reduce
memory
use as single uncompressed strips are chopped into multiple strips of ~8K). The problem is this strip
chopping changes the count and values in TIFFTAG_STRIPOFFSETS and
TIFFTAG_STRIPBYTECOUNTS, and Pmt will return these new updated values instead of the values that
are really in the file.
-------------------------------------------
Because strip chopping is unconditionally used in read-only mode, the OpenTiff toolkit modifies the
metadata keys TIFFTAG_STRIPOFFSETS & TIFFTAG_STRIPBY to have adjusted values that match
the
strip chopped buffers.

This in a sense seems like the right thing to do, since if OpenTiff supported a read-write mode,
the metadata keys would need to match the strips of image data (if the image data were written out in
strips). In other words, it seems like the toolkit is preparing itself for potentially writting the image data
in
strips, and ensuring the metadata keys match the image data.

However, since the file is being opened in read-only mode, the image data will never be written in strips,
and altering metadata keys based on the implementation of the toolkit (whether or not strip chopping is
on) does not reflect the status of the image file itself.

I think the initial values of these metadata keys should reflect exactly what's in the image file.
Whether or not strip chopping is on should not alter the values in these keys. The toolkit should handle
adjustments to such metadata keys only when writing the image file out (if and when a read-write mode
is
supported in PMT for TIFF files).

Rather than TIFFTAG_STRIPOFFSETS & TIFFTAG_STRIPBY being used by OpenTiff in the strip
chopping implementation, perhaps another set of data values can keep track of the information, leaving
the metadata keys with the image file's values.

There are other keys that could have a similar issue as the TIFFTAG_STRIPOFFSETS &
TIFFTAG_STRIPBY keys. In particular, the keys TIFFTAG_TILEOFFSETS and
TIFFTAG_TILEBYTECOUNTS have not been tested, but should be. An appropriate image file that uses
those keys needs to be used.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB