Imagine Toolkit

ERDAS IMAGINE, the world’s leading geospatial data authoring system, supplies tools for all your Remote Sensing and Photogrammetry needs.
Showing results for 
Search instead for 
Do you mean 

TIFF DLL Implementation Overview

by Technical Evangelist ‎10-01-2015 12:12 PM - edited ‎03-29-2016 09:18 AM (1,107 Views)

DLL Implementation


DLL Class Membership



The tiff DLL implementation is provided to allow immediate access, creation, and update of Tagged Image File Format (TIFF) files from within the IMAGINE product. TIFF is a popular and flexible public domain raster file format, the specification for which is claimed by Adobe Systems, Inc.

The tiff DLL implementation also recognizes the GeoTIFF extension to TIFF. According to the GeoTIFF Format Specification, Revision 1.0, "The GeoTIFF spec defines a set of TIFF tags provided to describe all 'Cartographic' information associated with TIFF imagery that originates from satellite imaging systems, scanned aerial photography, scanned maps, digital elevation models, or as a result of geographic analysis."

Refer to as a starting point for additional information on both TIFF and GeoTIFF.

Baseline TIFF

The tiff DLL implementation supports TIFF Revision 6.0. The support for TIFF Revision 6.0 is based on routines in LIBTIFF, Version 3.4 Beta 037, Copyright (c) 1988-1995 Sam Leffler, Copyright (c) 1991-1995 Silicon Graphics, Inc.

At a minimum, the intent is to support Baseline TIFF as defined by the Revision 6.0 specification. In general, any requirement of Baseline TIFF that is not specifically addressed in this document is assumed to be implemented by LIBTIFF and it is thought that the use of LIBTIFF by this DLL implementation will fulfill the requirement.

Implementation specific details are outlined below in a manner that matches the sectioning of the TIFF Revision 6.0 specification.

TIFF Structure

The Image File Header is used to identify the file as a TIFF file (see tiffFileTitleIdentifyAndOpen).

All Image File Directories (IFDs) other than the first one in the file are ignored by the tiff DLL, as it is not required for a Baseline TIFF reader.

Bilevel Images


If the PhotometricInterpretation tag indicates that WhiteIsZero, the pixel values are inverted prior to returning them through the tiffLayerRasterRead function.


The "No compression" option is the only option that specifically needs to be addressed by the tiff DLL implementation since the other compression options are handled through use of existing routines in LIBTIFF. Specifically, for BitsPerSample values less than 8, the data need to be unpacked into 1 pixel per byte prior to returning the data from the tiffLayerRasterRead function call. Conversely, the data need to be packed by the tiffLayerRasterWrite function call in the same situations.

Physical Dimensions

In the absence of any GeoTIFF information, the ResolutionUnit, XResolution, and YResolution values are considered and represented in the information returned from the tiffLayerMapInfoRead function.

Grayscale Images

No special implementation notes.

Palette-color Images

The ColorMap values in the image are converted to/from the TIFF defined range of 0 through 65535 from/to the IMAGINE defined range of 0.0 through 1.0 when they are written/read.

RGB Full Color Images

All layers of the full resolution image are made accessible by using the SamplesPerPixel value as the number of layers in the image.

Additional Baseline TIFF Requirements

Since the tiff DLL implementation provides update capabilities, it is essentially functioning within the IMAGINE product as a TIFF Editor. As such, the recommendations of the TIFF specification for TIFF Editors have been followed. Namely, a TIFF file modified in any way by the IMAGINE product will have any and all subfiles eliminated. Additionally, modifying the file in IMAGINE will cause all unrecognized fields (non-Baseline fields) to also be eliminated from the TIFF file.

This behavior can have serious consequences to a user's data. Therefore, the default behavior of the tiff DLL is to open all TIFF images with read-only access, regardless of the user's permissions on the file. The editing capabilities of the tiff DLL may be enabled by setting the "TIFF Image Files"/"Edits Allowed" preference to "true". Another preference, "Unknown Tags", allows the user to choose to copy unknown tags using simply their field description. In the case where the user chooses to copy unknown tags as-is, they should be made aware that (unrecognized) copied tags and data may be inconsistent with other modifications to the file.

Baseline Field Reference Guide


Not accessed except to copy over.


Used to determine the pixel type for a layer.

Images with a BitsPerSample value greater than 16 cannot have a color table stored for them and, thus, IMAGINE will not be able to remember that they are thematic. Therefore, LayerLayerTypeWrite is not be implemented.


Not accessed except to copy over.


Not accessed except to copy over.


See Palette-color Images.


See Bilevel Images.


Not accessed except to copy over.


Not accessed except to copy over.


Used to support multi-spectral imagery.


Not accessed and not copied over. Supported by LIBTIFF during the reading and writing of tiles and encoded strips.


Not accessed and not copied over.


Not accessed and not copied over.


Not accessed except to copy over.


Not accessed except to copy over.


Not accessed except to copy over.


Not accessed except to copy over.


Used as the layer height for all layers derived from a given subfile.


Used as the layer width for all layers derived from a given subfile.


Not accessed except to copy over.


Used as the maximum image value for data of 16 bits and less.


Used as the minimum image value for data of 16 bits and less.


Not accessed except to copy over.


Not accessed except to copy over since only the first subfile is accessed and it must have a subfile type of 0.


Used in conjunction with XResolution, YResolution and ResolutionUnit in simulating map information if no GeoTIFF information is present.


Used as discussed above.


Used to determine if BIP data needs to be re-arranged prior to being returned across the tiffLayerRasterRead interface.


See Orientation. By default, the DLL sets this tag explicitly to 1 (no absolute unit) when creating images.


Used as the block height for non-tiled images.


Used as the number of layers in the image. Multi-spectral imagery (greater than three bands) is stored as extra samples of unknown data.


Not accessed except to copy over.


Used implicitly in reading and writing data through LIBTIFF.


Used implicitly in reading and writing data through LIBTIFF.


Not accessed and not copied over.


Not accessed except to copy over.


See Orientation.


See Orientation.

PackBits Compression

Implemented through LIBTIFF.

Modified Huffman Compression

Implemented through LIBTIFF.

TIFF Extensions

Support for defined extensions of TIFF is enabled where support is provided in LIBTIFF. In instances where additional licensing is required, such as access to LZW compressed data, access through LIBTIFF has been controlled, but not disabled.

Implementation specific details are outlined below in a manner that matches the sectioning of the TIFF Revision 6.0 specification.

CCITT Bilevel Encodings

Implemented through LIBTIFF.

Document Storage and Retrieval

All associated tags are not accessed except to copy over.

LZW Compression

Implemented through LIBTIFF. Access controlled during tiffLayerRasterRead (denied if LZW license not present).

Differencing Predictor

Implemented through LIBTIFF in conjunction with LZW Compression.

Tiled Images

Implemented through LIBTIFF. Tile width and tile height used for block width and block height of layers. The "TIFF Image Files"/"Create Tiled Images" preference controls how new TIFF files are created from the DLL, since there is no opportunity to prompt the user.

CMYK Images

Implemented through LIBTIFF. No attempt is made to perform a color space conversion to RGB for return. Associated tags are not accessed except to copy over.


All associated tags are not accessed except to copy over.

Associated Alpha Handling

All associated tags are not accessed except to copy over.

Data Sample Format

This extension is used to support signed integer data types as well as floating point images. The SMinSampleValue and SMaxSampleValue tags are used in a manner similar to MinSampleValue and MaxSampleValue when dealing with data that is greater than 16 bits.

RGB Image Colorimetry

Associated tags are not accessed except to copy over.

YCbCr Images

Digital video format. All associated tags are not accessed except to copy over. As with CMYK, no attempt is made to perform a color space conversion to RGB for return.

JPEG Compression

Implemented through LIBTIFF.

CIE L*a*b* Images

Implemented through LIBTIFF. As with CMYK, no attempt is made to perform a color space conversion to RGB for return.


The RasterFormats interface functions that relate to georeferencing and geocoding in the tiff DLL implementation were developed to support GeoTIFF Revision 1.0. The support for GeoTIFF Revision 1.0 is based on the final 1.0 release version of the platform-independent public-domain subroutine library for such purpose, Copyright (c) 1995 Niles D. Ritter.

GeoTIFF divides the cartographic information associated with a TIFF image into two pieces: georeferencing and geocoding. This maps closely to IMAGINE's MapInformation and Projection but there are some differences that need to be handled.


GeoTIFF defines georeferencing as tying the raster space of an image to a model space (a map system). The georeferencing information is represented in three TIFF tags: ModelTiepointTag, ModelPixelScaleTag, and ModelTransformationTag.

If ModelTiepointTag indicates that there is one tie point and the ModelPixelScaleTag is present, a MapInfo model is simulated.

If the ModelTransformationTag is present, an Affine model is created from the transformation information.

In the case where the ModelTiepointTag is present but the ModelPixelScaleTag is not, the "TIFF Image Files"/"Approximate Tie Points with a Polynomial" preference controls whether this image will be treated as georeferenced or not (a preference value of TRUE will allow the image to be treated as georeferenced).

GeoTIFF has a notion of Raster Space which defines how the raster coordinate system grid lines lie with respect to the center of the pixel values in the image. The approach used in IMAGINE is analogous to the PixelIsPoint Raster Space of GeoTIFF, i.e., the grid lines of the raster coordinate system intersect at the center of the pixel. Therefore, an adjustment to the georeferencing information is always made if the PixelIsArea Raster Space is indicated in the GeoTIFF parameters so that IMAGINE applications will act on the georeferencing information correctly. When creating the information in a TIFF file, the PixelIsArea Raster Space is always used.

Notably missing from the georeferencing information in the GeoTIFF scheme is the model (map system) name and the units with which the georeferencing information is specified. This poses a problem for the tiff DLL because some IMAGINE applications allow georeferencing without geocoding. In the GeoTIFF scheme, both the units and the model name are deduced from the geocoding information. When this information cannot be produced, the units and model name must be remembered in a citation associated with one of the GeoTIFF keys.


GeoTIFF defines geocoding as tying coordinates in a model space to locations on the earth. Geocoding information is stored in a "MetaTag" (GeoKey) approach, a system of tagging that allows dozens of information elements to be encoded using just three TIFF tags.

GeoTIFF uses GeoKeys to define projection types, coordinate systems, datums, ellipsoids, etc. so that geocoding a TIFF image is possible. These GeoKeys were derived from the EPSG list compiled by the Petrotechnical Open Software Corporation (POSC).

Converting this geocoding information to/from something that can be used in IMAGINE is a straightforward, albeit massive, translation task.

One issue already touched on is the fact that the geocoding information holds the units for the georeferencing information. When a standard projected coordinate system is used, the units are implied by this standard projected coordinate system. These implied units come from the tables of EPSG/POSC information referred to above. Because of this, a dilemma arises in translating georeferencing and geocoding information defined in IMAGINE to a TIFF file: should an otherwise standard projection be decomposed into appropriate user defined projection codes so that the non-standard units of georeferencing may be retained, or should the standard projection code be used and the georeferencing information be altered to reflect the implied standard units? To solve this dilemma, it is left to the user to set the "TIFF Image Files"/"Geocoding preserves..." to either "Georeferencing Units" or "Standard Projections" as desired.

DEM Data

The ModelTiePointTag and ModelPixelScaleTag contain offset and scale information for DEM data that is currently ignored.

ARC/INFO World File

In the absence of GeoTIFF keys and prior to falling back on the device space information, the tiff DLL optionally searches for a world file associated with the TIFF file and uses any information found as the georeferencing of the image. The optional access and maintenance of the world file by this DLL is controlled through the "TIFF Image Files"/"World File Access" preference. The world file is incapable of storing map system name or unit name information, and it provides georeferencing information only (not geocoding).

Interface Function Support

Appropriate interface functions are provided both to access and update information relevant to the TIFF file format.

The main data items that are accessible include the raster data, georeferencing information, geocoding information, and a color table.

Developed At ERDAS By

Eric Pohl, Max Martinez