[Gdal-dev] TIFF Driver & overviews
warmerdam at pobox.com
Mon Sep 1 15:45:34 EDT 2003
Julien Demaria wrote:
> I have some questions about the (Geo)TIFF GDAL driver :
> - can we access to multi-directories TIFF ?
> - can we access to sub-directories (using SubIFD tag) ?
There was recently a change made so that images within a TIFF file can
be accessed even if they aren't in the first directory.
Use the construct:
to access a particular directory (n = 0 is the 1st, n = 1 is the 2nd
and so on). This only works for directories in the "main chain".
You can also access a directory by byte offset if you happen to have
that available using the dataset naming:
In this case <n> is a raw byte offset in the file, and could access a
sub-ifd or even a directory not otherwise findable. I use this mainly
for testing but it is user accessable.
> - can I use existing overviews stored in a separate TIFF file or in the
> sub-directories ?
Currently external overviews and sub-ifd overviews are not supported by
the GeoTIFF driver, though this behaviour could be altered. In particular
I would like to add support for sub-IFD overviews since that is really
a cleaner approach to overviews than the current chained approach.
> - In the code I see that the overviews are stored in directories after
> the first (the first is the full resolution image) ;
> can I store them in another place ? (example in another
> multi-directories TIFF file or inside the TIFF file but in the
> corresponding sub-directories of each directory) ?
> General questions about overviews :
> - do the drivers support not standard overviews ? (example full image
> 100x200 and overview 43x17)
When you say non-standard, you mean with a different aspect ratio than
the base image? I think the various drivers that support overviews could
work with odd-aspect ratio overviews, but might well get confused about
what their downsampling factor is for purposes of selecting the optimal
overview. I haven't experimented much with this. There is no support for
generating overviews with odd aspect ratios.
> - I don't understand in the documentation if for an image 100x200 with 2
> overview 50x100 and 25x50 I can read directly a 30x60 buffer ?
> Is decimation read only allowed with the exact result size of an
> overview ?
> Can I read directly a 200x400 buffer in this image ?
> If yes can we control the pixels decimation/replication method ?
You can do all of the above. That is to say, you can read at resolutions
other the full resolution or any of the overview levels. GDAL will select
the lowest resolution overview that is at least as high a resolution as
the chunk you have requested. Differing aspect ratios may confuse this
You can even load oversampled images by specifying a buffer larger than
the base image.
However, you cannot control the sampling mechanism used for this.
Simple decimation and replication is used (what is sometimes called
nearest neighbour sampling). If you want control over sampling methods
you need to use the Warp API or do the sampling yourself.
> - for formats that don't support overviews does GDAL always store the
> overviews in another multi-directories TIFF file ?
That is the normal fallback mechanism. However, it has to be explicitly
enabled in each format driver, and some format drivers have not done so.
Drivers with dataset names that aren't really filesystem paths won't
generally support this kind of overview since it isn't obvious where to
> sorry for the overflow of questions ;-)
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev