ImageGear for C and C++ on Linux v18.10 - Updated
TIFF
User Guide > File Formats and Compressions > File Formats > File Formats Reference > TIFF
Full Name TIFF (Tagged Image File Format)
Format ID IG_FORMAT_TIF = 40
File Extension(s) *.tif, *.tiff
Data Type Raster Image
Data Encoding Binary
Color Profile Support Read, Write
Multi-Page Support Yes
Alpha Channel Support Yes
ImageGear Platforms Support WIN32, WIN64, Unix, Unix64, .NET, .NET64, MAC

ImageGear Supported Versions:

ImageGear Supported Features:

ImageGear Read Support:

To use the LZW (Lempel-Ziv-Welch) compression scheme, attach the ImageGear LZW Component. See Attaching Components.

ImageGear Write Support:

To use the LZW (Lempel-Ziv-Welch) compression scheme, attach the ImageGear LZW Component. See Attaching Components.

ImageGear Filter Control Parameters:

Filter Control Parameter Type Default Value Available Values Description
BIG_ENDIAN AT_BOOL FALSE FALSE, TRUE If TRUE, big endian order is used for write operation ("MM"), in other case little endian is used("II").
BITONAL_PALETTE_MODE enumTIFFBitonalPaletteMode IG_TIF_BITONAL_PALETTE_MODE_LEGACY An enumTIFFBitonalPaletteMode value Specifies whether ImageGear shall fix strange looking palettes when reading bi-tonal TIFF images.
BUFFER_SIZE DWORD 32768 Any DWORD>0 This parameter specifies the buffer size for each strip for write operation if WRITE_CONFIG= =IG_TIF_STRIP_FIXED_BUFFER
DATETIME LPCHAR "" Specifies value for DateTime (tag 306) to write into image.
DO_NOT_WRITE_PALETTE AT_BOOL FALSE FALSE, TRUE Set to TRUE to skip the palette when writing a TIFF.
DOCUMENT_NAME LPCHAR "" Any string Specifies value for DocumentName (tag 269) to write into image.
FAST_PAGE_COUNT AT_BOOL FALSE FALSE, TRUE Affects page counting. When FALSE, ImageGear counts only those IFDs that contain images. When TRUE, ImageGear counts all IFDs, without checking for presence of images in them. The latter mode requires significantly less reading operations and thus works faster, especially if the image is accessed through a network.
FILL_ORDER MODE IG_FILL_MSB IG_FILL_MSB, IG_FILL_LSB Specifies fill order (tag 266) for TIFF file to be written. Use the default IG_FILL_MSB, but okay to use IG_FILL_LSB only for IG_COMPRESSION_CCITT_G3, IG_COMPRESSION_CCITT_G4, IG_COMPRESSION_CCITT_G32D, or IG_COMPRESSION_HUFFMAN
IMAGE_BEFORE_IFD AT_BOOL FALSE FALSE, TRUE This flag specifies physical location of raster data inside TIFF file relatively to IFD record. If this value is TRUE then image data is to be written before IFD record.
IMAGE_HEIGHT DWORD 0 Any positive value Was used internally in previous versions of ImageGear.
IMAGE_WIDTH DWORD 0 Any positive value Was used internally in previous versions of ImageGear.
INCLUDE_PAGE_NUMBER AT_BOOL TRUE FALSE, TRUE If this parameter is TRUE then include tag 297 into TIFF image with real value of page number.
LOAD_FIRST_UNKNOWN_CHANNEL_AS_PALPHA AT_BOOL TRUE TRUE, FALSE This parameter specifies how to load first extra channel if ExtraSamples tag is missing. If TRUE, ImageGear loads first extra channel as Premultiplied Alpha channel. This mode provides support for RGBPA TIFF images written by earlier versions of ImageGear. If LoadFirstUnknownChannelAsPAlpha is FALSE, ImageGear loads all extra channels as extra channels.
MISSING_COMPRESSION AT_MODE 0 Missing compression.
NEW_SUBFILE_TYPE UINT 0xFF This parameter specifies value for tag 254. If value of this control parameter 0xFF then default value is used according to TIFF 6.0 format specification.
NUMBER_OF_STRIPS UINT 1 Any value >0 If WRITE_CONFIG= =IG_TIF_STRIP_FIXED_COUNT then this value is used as the number of strips to be written.
PHOTOMETRIC UINT IG_TIF_PHOTO_WHITEZERO IG_TIF_PHOTO_WHITEZERO, IG_TIF_PHOTO_BLACKZERO, IG_TIF_PHOTO_RGB, IG_TIF_PHOTO_CMYK, IG_TIF_PHOTO_PALETTE, IG_TIF_PHOTO_TRANSPARENCY, IG_TIF_PHOTO_YCBCR, IG_TIF_PHOTO_CIELAB Specifies photometric interpretation (tag 262) for write operation.
PLANAR AT_BOOL FALSE FALSE, TRUE Specifies tag value 284 for output image.
READ_JPEG_AS_YCBCR AT_BOOL FALSE TRUE, FALSE For internal use.
SAVE_DIFF_PREDICTOR AT_BOOL FALSE FALSE, TRUE If this parameter is TRUE, then the horizontal differencing predictor will be applied on the image before compressing it, which may result in a smaller output file. This option is most efficient on continuous tone images, such as photographs.
SAVE_INDEXED_GRAY_AS_GRAY AT_BOOL TRUE FALSE, TRUE Affects saving of images that have grayscale or inverted grayscale palette. If TRUE then ImageGear saves the image with BlackZero or WhiteZero photometric interpretation. Otherwise, ImageGear saves the image as Paletted.
SAVE_IPTC_NAA AT_BOOL FALSE TRUE, FALSE Affects TIFF and EXIF-TIFF image saving. Set to TRUE to enable the saving of IPTC_NAA tag (33723) to the TIFF IFD, if IPTC metadata is provided by the metadata callbacks. If IPTC metadata is also provided as part of the PhotoshopResources metadata, then ImageGear overwrites it with a copy of metadata from IPTC_NAA tag. Set to TRUE to skip the writing of IPTC_NAA tag (for backward compatibility with ImageGear 17.1).
STITCH_TILES AT_BOOL FALSE TRUE, FALSE Set to TRUE to enable automatic tile stitching during image loading.
SUBIFD_PATH LPCHAR Empty string Number of the SubIFD from which to load the image. If set to empty string (default), load image from root IFD. See "Camera Raw Image support" section for more detail.
TILE_H_COUNT DWORD 10 If WRITE_CONFIG==IG_TIF_TILED_FIXED_COUNT then this value is used as number of tiles in horizontal dimension.
TILE_HEIGHT DWORD If WRITE_CONFIG==IG_TIF_TILED_FIXED_SIZE then this value is used to specify vertical dimension of each tile.
TILE_V_COUNT DWORD 10 If WRITE_CONFIG==IG_TIF_TILED_FIXED_COUNT then this value is used as number of tiles in vertical dimension.
TILE_WIDTH DWORD 64 If WRITE_CONFIG==IG_TIF_TILED_FIXED_SIZE then this value is used to specify horizontal dimension of each tile.
TREAT_THUMBNAILS_AS_PAGES AT_BOOL TRUE TRUE, FALSE If TRUE, all IFDs containing raster image information are considered as pages. If FALSE, IFDs marked as thumbnails are not included in page set.
UPDATE_LUT16 AT_BOOL TRUE TRUE, FALSE
UPDATE_PAGE_NUMBERS AT_BOOL TRUE TRUE, FALSE
WRITE_CLASS_F AT_BOOL FALSE FALSE, TRUE If this value is TRUE then image to be written in TIFF format compatible with class F requirements.
WRITE_CONFIG MODE IG_TIF_STRIP_FIXED_COUNT IG_TIF_STRIP_FIXED_COUNT, IG_TIF_STRIP_FIXED_BUFFER, IG_TIF_TILED_FIXED_SIZE, IG_TIF_TILED_FIXED_COUNT

Specifies configuration of TIFF file to be written:

  • IG_TIF_STRIP_FIXED_COUNT - writes fixed number of strips.
  • IG_TIF_STRIP_FIXED_BUFFER - writes strips of size no more then given size.
  • IG_TIF_TILED_FIXED_SIZE - writes image in tiles of specified size.
  • IG_TIF_TILED_FIXED_COUNT - divides image into specified number of tiles vertically and horizontally.
WRITE70 AT_BOOL TRUE FALSE, TRUE If this value is TRUE then output TIFF-JPEG image will be produced in TIFF 7.0 compatible format but in other case it will be compatible with TIFF 6.0.

Comments:

TIFF was developed for use in storing black-and-white images from scanners and desktop publishing applications. Now, in its fourth release (version 6.0), it is one of the most detailed and versatile bitmap formats in use. It is supported by most art, imaging, and word-processing applications. It supports several compression schemes. Aside from saving image data in bitmap form, it can also contain vector or text-based images.

Containing just three fields, the TIFF header is simple and one of the shortest of all the graphics file format headers. But, the structure of a TIFF is complicated, with variable length fields, variable number of fields, and the ability to store information (other than the header) in any order desired.

The other two major components of the TIFF format are "Image File Directories" (IFDs) and the image or images themselves. There is one IFD per image stored. The combination of an IFD and an image is referred to as a "subfile". The header contains an offset pointer to the first IFD. If there are multiple IFDs, each contains an offset to the next. The last IFD contains a value that signifies the end of the file.

IFDs closely resemble a header structure, and the information stored in them is often referred to as "TIFF Header Information". Unlike a header, however, they contain a variable number of "tags" (pointers or fields). In addition, each tag can point to data with a variable length. TIFFs are notorious for the number of tags that they can contain, up to a maximum of 65,535 tags of nearly 100 different types (version 6.0). Tags are listed in order by code number so that a TIFF reader can easily determine what fields are present. While ImageGear reads and stores all TIFF tags, it utilizes a subset of all of the possible tags. See note on previous page.

In version 5.0, the presence of certain subgroups of tags determined the "class" to which the TIFF belonged. The classes are: TIFF-B-monochrome, TIFF-F-facsimile, TIFF-G-grayscale, TIFF-P-palette based, TIFF-R-RGB color, TIFF-X-any class, TIFF-Y-can use JPEG compression. Version 6.0 uses tags to divide the TIFF type into different file configurations, leaving behind the class concept. Version 6.0 configurations are: Bilevel, palette color, RGB, grayscale, YCbCr, and Class F (facsimile).

TIFF bitmap data can be stored in one of two configurations: strips or tiles. Strips are groups of adjoining rows of bitmap data, and can be found in version 5.0 and 6.0 files. Tiles were new to TIFF version 6.0. They are rectangular or square sections of bitmap data. The method of storage is determined in part by what kind of compression (if any) is used. JPEG compression can handle tiled images. Due to the need for padding with tile storage, tiling is not usually efficient for small images.

ImageGear supports the following compression schemes for TIFF:

See the ImageGear Supported Compressions Reference for descriptions of these compression types. The compression tag of the IFD tells whether the image is compressed, and by what method. (Not all TIFF files can use JPEG compression. It is supported by version 6.0, but in version 5.0, only a "Y" class TIFF can use JPEG).

TIFF/EP

TIFF/EP format was designed to provide a means for storing "raw" (unprocessed) image from digital camera's sensor.

TIFF/EP allows you to store several versions of the same image in one file. Typically, TIFF/EP image includes a small preview and a raw image. It can also include a larger or full-size preview, or some other variations of the image.

TIFF/EP uses IFD trees for storing different versions of image. This is different from IFD chains that are used in baseline TIFF to store multiple pages.

ImageGear does not detect TIFF/EP as a separate file format. One of well known extensions to TIFF/EP is Adobe DNG format. ImageGear detects it as a separate file format.

Most of digital cameras store pixels in "mosaic" format. At a given pixel location either a Red, Green, Blue, Cyan, or some other color sample value is recorded. Such images are referred to as "Color Filter Array" type. TIFF/EP format uses a two-dimensional matrix called "Color Filter Array pattern" to describe positions of pixels of particular color in the mosaic image. In order to recreate the full color values in each pixel, it is necessary to interpolate intensities of neighboring pixels.

To enable loading images from TIFF SubIFDs, a new control parameter is added to TIFF filter: "SUBIFD_PATH". This parameter has the type of String, and its default value is "" (empty string). By default, ImageGear loads the image in the root IFD (thumbnail). If "SUBIFD_PATH" string begins with a number, then ImageGear loads the image from the corresponding SubIFD of the root IFD. For example, if SUBIFD_PATH is set to "3", ImageGear will load the image from the 3rd SubIFD.

SUBIFD_PATH parameter also affects metadata reading. Metadata is loaded starting from the IFD specified by SUBIFD_PATH.

ImageGear does not support color reconstruction of TIFF/EP images, unless they are detected to be a Adobe DNG image supported by ImageGear.

References Used:

Brown, C. Wayne, and Barry J. Shepherd. Graphics File Formats: Reference and Guide. Greenwich, CT.: Manning Publications, 1992.

Kay, David C. and John R. Levine. Graphics File Formats. Windcrest Books, 1992.

Murray, James D. "Graphic Image Format FAQ 3-4". James D. Murray, 1994-1996.

Murray, James D. and William vanRyper. Encyclopedia of Graphics File Formats. Sebastopol, CA: O'Reilly & Associates, Inc., 1994.