1999.03.12 18:03 "TIFF Overview Generation", by Frank Warmerdam

Folks,

I have implemented a small utility program to generate overviews in TIFF files, called ``addtiffo'' and based on Sam's libtiff. I have put the source, and a windows executable up for ftp at:

  ftp://gdal.velocet.ca/pub/tiff/

The program builds overviews within the TIFF file as additional images with the reduced resolution flag set. I would appreciate it if anyone interested with an application that can use overviews would try using my program to build them, and test for compatibility.

Anyone interested in making their TIFF viewer application support overviews may contact me for help.

Note this program implements overviews as appended IFDs on the main IFD chain. It doesn't use the SUBIFD flag as suggested by one of the technical notes on the adobe site. First, most existing overview using applications seem to do it with simple chaining rather than SUBIFD, and secondly it is very hard to insert a SUBIFD flag into an existing TIFF file using libtiff.

I hope to fix this someday (perhaps by copying the original dataset as well), but not today.

I am particularly interested in getting this working with remote sensing and GIS applications (hence the inclusion of the GeoTIFF list even though this isn't a ``geo'' issue).

All feedback welcome. Sam... I can clean this up for inclusion in the tools or contrib directory if you are interested.

Best regards,

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

        addtiffo 1.0
        ============

The addtiffo utility is used to add overview pyramids to an existing TIFF or GeoTIFF file. Some applications can take advantage of these overviews to accelerate overview display performance of large rasters.

This release of addtiffo is primarily intended for compatibility testing with applications, and to see if there is interest in a cleaner release of the capability... perhaps incorporation into the libtiff tools distribution.

Please feel free to contact me with questions, or problems.

warmerda@home.com
http://members.home.com/warmerda

Usage

Usage: addtiffo [-subifd] tiff_filename [resolution_reductions]

Example:
 % addtiffo abc.tif 2 4 8 16

The numeric arguments are the list of reduction factors to generate. In this example a 1/2, 1/4 1/8 and 1/16

Limitations

See tif_overview.cpp for up to date details.

TIFF File Tags

The results of running addtiffo on a 1024x1024 tiled greyscale file with the arguments ``2 4 8 16'' is to add four additional TIFF directories appended on the file with the SUBFILETYPE flag to 0x1 indicating the extra items are reduced resolution images.

The tiffinfo output of such a file might look like this:

TIFF Directory at offset 0x118008
  Image Width: 1024 Image Length: 1024
  Tile Width: 256 Tile Length: 112
  Bits/Sample: 8
  Compression Scheme: none
  Photometric Interpretation: min-is-black
  Samples/Pixel: 1
  Planar Configuration: single image plane
TIFF Directory at offset 0x15e1d2
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 512 Image Length: 512
  Tile Width: 256 Tile Length: 112
  Bits/Sample: 8
  Compression Scheme: none
  Photometric Interpretation: min-is-black
  Samples/Pixel: 1
  Planar Configuration: separate image planes
TIFF Directory at offset 0x1732b8
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 256 Image Length: 256
  Tile Width: 256 Tile Length: 112
  Bits/Sample: 8
  Compression Scheme: none
  Photometric Interpretation: min-is-black
  Samples/Pixel: 1
  Planar Configuration: separate image planes
TIFF Directory at offset 0x17a366
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 128 Image Length: 128
  Tile Width: 128 Tile Length: 112
  Bits/Sample: 8
  Compression Scheme: none
  Photometric Interpretation: min-is-black
  Samples/Pixel: 1
  Planar Configuration: separate image planes
TIFF Directory at offset 0x17b40c
  Subfile Type: reduced-resolution image (1 = 0x1)
  Image Width: 64 Image Length: 64
  Tile Width: 64 Tile Length: 64
  Bits/Sample: 8
  Compression Scheme: none
  Photometric Interpretation: min-is-black
  Samples/Pixel: 1
  Planar Configuration: separate image planes

Building

You will need a C, and C++ compiler. You will need to have libtiff already built and installed. The provided Makefile should work on most Unix systems. A similar file will be needed for Windows, but is not provided.

The CFLAGS and LIBS macros in the Makefile will have to be updated to point to the correct location of the libtiff include files, and library.

Credits