2000.08.10 22:06 "RowsPerStrip -- tiffdump vs. TIFFGetField", by Mccarty Michael J

2000.08.11 14:21 "Re: RowsPerStrip -- tiffdump vs. TIFFGetField", by Frank Warmerdam

In an application I am developing that uses libtiff, I have noticed that the value for TIFFTAG_ROWSPERSTRIP (278) reported by tiffdump is different than the value returned by TIFFGetField(TIFFTAG_ROWSPERSTRIP). I have observed this behaviour on both the Win32 platform and on Unix. Has anyone else seen this behaviour?

Michael,

>From tiffconf.h:

 * STRIPCHOP_DEFAULT    default handling of strip chopping support (whether
 *                      or not to convert single-strip uncompressed images
 *                      to mutiple strips of ~8Kb--to reduce memory use)

Basically, by default libtiff will make one-strip files look like many small strips in order to make applications that assume they can read one strip work well. The tiffdump program directly accesses the file, and shows real values. The tiffinfo and other programs using libtiff will see synthesized values, as if there were many small strips. This behaviour can be disabled by resetting STRIPCHOP_DEFAULT in tiffconf.h and recompiling libtiff.

Andreas_Kleinert says:
> Michael says:
>> in = TIFFOpen( "doctemp.tif", "r" );
>
> That better should be "rb".

libtiff automatially assumes TIFF files are binary. This is handled in the platform specific open functions, such as TIFFOpen() in tif_unix.c or tif_win32.c. It isn't necessary for applications to provide the binary flag to TIFFOpen().

>> TIFFGetField( in, TIFFTAG_ROWSPERSTRIP, &rps );
>
> Checking "in" for being != NULL and checking
> the return value of TIFFGetField() would be a good idea.

The point of a minimal demonstration program is to show the behaviour in question with the minimum amount of error checking, and other unrelated code getting in the way.

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerda@home.com
light and sound - activate the windows | http://members.home.com/warmerda
and watch the world go round - Rush    | Geospatial Programmer for Rent