From: warmerdam@pobox.com (Frank Warmerdam)
Date: Wed, 17 Sep 2003 18:39:30 -0400
Subject: [Tiff] is image tiled or striped?
In-Reply-To: <MJEBIBGMCDKIGEHPDECCGECPCBAA.pushkar@erc.msstate.edu>
References: <MJEBIBGMCDKIGEHPDECCGECPCBAA.pushkar@erc.msstate.edu>
Message-ID: <3F68E2A2.4000701@pobox.com>

Pushkar Pradhan wrote:
> I want to check whether an image is tiled or striped? Is there a function to
> check this in libtiff?
> 
> When I do
>   TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tileWidth);
>   TIFFGetField(tif, TIFFTAG_TILELENGTH, &tileLength);
> They return very big nos. (1075531856, 1075536024) but not a -1 etc.
> 
> Maybe I could do a check:
> if (tileLength > 1024 || tileWidth > 1024)
> /* This is a striped image */
> 
> But I don't know whether that's guaranteed to be such a big +ve no. or -ve
> no.
> 
> So can somebody advise what's the most appropriate way to check this?
> Pushkar Pradhan

Pushkar,

Call TIFFIsTiled(tif).  If it returns a non-zero value the file is tiled,
otherwise stripped.

Best regards,

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



