ImageGear v26.3 - Updated
Developer Guide / File Formats and Compressions / File Formats / File Formats Reference / TIFF
In This Topic
    TIFF
    In This Topic
    Full Name TIFF (Tagged Image File Format)
    Format ID ImGearFormats.TIF
    File Extension(s) *.tif, *.tiff
    Data Type Raster Image
    Data Encoding Binary
    Multi-Page Support Yes
    Alpha Channel Support Yes
    Metadata Update Support Page

    ImageGear Supported Versions

    • Version 6.0 - Added support for CMYK and YCbCr color images, and JPEG compression. Ability to store pixels in "tiles"
    • Version 5.0 - Added ability to store palette color images and support for LZW compression. This version featured TIFF "classes."
    • Version 4.0 - Added support for uncompressed RGB color images.
    • Version 3.0 - First public release.

    ImageGear Supported Features

    • IGFilterFormatFlags.DETECTSUPPORT - autodetection
    • IGFilterFormatFlags.PAGEREADSUPPORT - single page file reading
    • IGFilterFormatFlags.MPAGEREADPSUPPORT - multi-page file reading
    • IGFilterFormatFlags.PAGEINSERTSUPPORT - single-page file writing
    • IGFilterFormatFlags.MPAGEWRITEPSUPPORT - multipage file writing
    • IGFilterFormatFlags.PAGEDELETESUPPORT - page deleting from multi-page file
    • IGFilterFormatFlags.PAGESWAPSUPPORT - page swaping in multi-page files
    • IGFilterFormatFlags.MPDATASUPPORT - faster multi-page access by storing private format data (used only with IG_mpi_... and IG_mpf_... API)

    ImageGear Read Support

    • ImGearCompressions.NONE:
      • Indexed RGB - 1, 2, 4, 8 bpp;
      • Grayscale - 1, 2, 4, 8, 12, 16, 32 bpp;
      • RGB: 3, 6, 12, 24, 36, 48 bpp;
      • Lab: 3, 6, 12, 24, 36, 48 bpp;
      • CMYK: 4, 8, 16, 32, 48, 64 bpp;
      • Grayscale + Premultiplied Alpha: 2, 4, 8, 12, 16, 32 bpp;
      • RGB + Premultiplied Alpha: 4, 8, 16, 32, 48, 64 bpp;
      • Indexed RGB + Extra: 1, 2, 4, 8 bpc;
      • Lab + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • CMYK + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • Grayscale + Premultiplied Alpha + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • RGB + Premultiplied Alpha + Extra: 1, 2, 4, 8, 12, 16 bpc.
    • ImGearCompressions.PACKED_BITS:
      • Indexed RGB - 1, 2, 4, 8 bpp;
      • Grayscale - 1, 2, 4, 8, 12, 16, 32 bpp;
      • RGB: 3, 6, 12, 24, 36, 48 bpp;
      • Lab: 3, 6, 12, 24, 36, 48 bpp;
      • CMYK: 4, 8, 16, 32, 48, 64 bpp;
      • Grayscale + Premultiplied Alpha: 2, 4, 8, 12, 16, 32 bpp;
      • RGB + Premultiplied Alpha: 4, 8, 16, 32, 48, 64 bpp;
      • Indexed RGB + Extra: 1, 2, 4, 8 bpc;
      • Lab + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • CMYK + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • Grayscale + Premultiplied Alpha + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • RGB + Premultiplied Alpha + Extra: 1, 2, 4, 8, 12, 16 bpc.
    • ImGearCompressions.HUFFMAN:
      • Indexed RGB: 1 bpp;
      • Grayscale: 1 bpp;
    • ImGearCompressions.CCITT_G3:
      • Indexed RGB: 1 bpp;
      • Grayscale: 1 bpp;
    • ImGearCompressions.CCITT_G4:
      • Indexed RGB: 1 bpp;
      • Grayscale: 1 bpp;
    • ImGearCompressions.CCITT_G32D:
      • Indexed RGB: 1 bpp;
      • Grayscale: 1 bpp;
    • ImGearCompressions.JPEG:
      • Grayscale: 8 bpp;
      • RGB: 24 bpp
    • ImGearCompressions.DEFLATE:
      • Indexed RGB - 1, 2, 4, 8 bpp;
      • Grayscale - 1, 2, 4, 8, 12, 16, 32 bpp;
      • RGB: 3, 6, 12, 24, 36, 48 bpp;
      • Lab: 3, 6, 12, 24, 36, 48 bpp;
      • CMYK: 4, 8, 16, 32, 48, 64 bpp;
      • Grayscale + Premultiplied Alpha: 2, 4, 8, 12, 16, 32 bpp;
      • RGB + Premultiplied Alpha: 4, 8, 16, 32, 48, 64 bpp;
      • Indexed RGB + Extra: 1, 2, 4, 8 bpc;
      • Lab + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • CMYK + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • Grayscale + Premultiplied Alpha + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • RGB + Premultiplied Alpha + Extra: 1, 2, 4, 8, 12, 16 bpc.
    • ImGearCompressions.LZW:
      • Indexed RGB - 1, 2, 4, 8 bpp;
      • Grayscale - 1, 2, 4, 8, 12, 16, 32 bpp;
      • RGB: 3, 6, 12, 24, 36, 48 bpp;
      • Lab: 3, 6, 12, 24, 36, 48 bpp;
      • CMYK: 4, 8, 16, 32, 48, 64 bpp;
      • Grayscale + Premultiplied Alpha: 2, 4, 8, 12, 16, 32 bpp;
      • RGB + Premultiplied Alpha: 4, 8, 16, 32, 48, 64 bpp;
      • Indexed RGB + Extra: 1, 2, 4, 8 bpc;
      • Lab + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • CMYK + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • Grayscale + Premultiplied Alpha + Extra: 1, 2, 4, 8, 12, 16 bpc;
      • RGB + Premultiplied Alpha + Extra: 1, 2, 4, 8, 12, 16 bpc.

    ImageGear Write Support

    TIFF writer requires read/write access to the output stream.

    • ImGearCompressions.NONE:
      • Indexed RGB: 1, 4, 8 bpp;
      • Grayscale: 8, 12, 16 bpp;
      • RGB: 24, 36, 48 bpp;
      • Lab: 24, 36, 48 bpp;
      • CMYK: 32, 48, 64 bpp;
      • Grayscale + Premultiplied Alpha: 16, 24, 32 bpp;
      • RGB + Premultiplied Alpha: 32, 48, 64 bpp;
      • Lab + Extra: 8, 12, 16 bpc;
      • CMYK + Extra: 8, 12, 16 bpc;
      • Grayscale + Premultiplied Alpha + Extra: 8, 12, 16 bpc;
      • RGB + Premultiplied Alpha + Extra: 8, 12, 16 bpc;
    • ImGearCompressions.PACKED_BITS:
      • Indexed RGB: 1, 4, 8 bpp;
      • Grayscale: 8, 12, 16 bpp;
      • RGB: 24, 36, 48 bpp;
      • Lab: 24, 36, 48 bpp;
      • CMYK: 32, 48, 64 bpp;
      • Grayscale + Premultiplied Alpha: 16, 24, 32 bpp;
      • RGB + Premultiplied Alpha: 32, 48, 64 bpp;
      • Lab + Extra: 8, 12, 16 bpc;
      • CMYK + Extra: 8, 12, 16 bpc;
      • Grayscale + Premultiplied Alpha + Extra: 8, 12, 16 bpc;
      • RGB + Premultiplied Alpha + Extra: 8, 12, 16 bpc;
    • ImGearCompressions.HUFFMAN:
      • Indexed RGB: 1 bpp;
    • ImGearCompressions.CCITT_G3:
      • Indexed RGB: 1 bpp;
    • ImGearCompressions.CCITT_G4:
      • Indexed RGB: 1 bpp;
    • ImGearCompressions.CCITT_G32D:
      • Indexed RGB: 1 bpp;
    • ImGearCompressions.JPEG (Lossy):
      • Grayscale: 8, 12 bpp;
      • RGB: 24, 36 bpp;
    • ImGearCompressions.JPEG (Lossless):
      • Grayscale: 8, 16 bpp;
      • RGB: 24 bpp;
    • ImGearCompressions.DEFLATE:
      • Indexed RGB: 1, 4, 8 bpp;
      • Grayscale: 8, 12, 16 bpp;
      • RGB: 24, 36, 48 bpp;
      • Lab: 24, 36, 48 bpp;
      • CMYK: 32, 48, 64 bpp;
      • Grayscale + Premultiplied Alpha: 16, 24, 32 bpp;
      • RGB + Premultiplied Alpha: 32, 48, 64 bpp;
      • Lab + Extra: 8, 12, 16 bpc;
      • CMYK + Extra: 8, 12, 16 bpc;
      • Grayscale + Premultiplied Alpha + Extra: 8, 12, 16 bpc;
      • RGB + Premultiplied Alpha + Extra: 8, 12, 16 bpc;
    • ImGearCompressions.LZW:
      • Indexed RGB: 1, 4, 8 bpp;
      • Grayscale: 8, 12, 16 bpp;
      • RGB: 24, 36, 48 bpp;
      • Lab: 24, 36, 48 bpp;
      • CMYK: 32, 48, 64 bpp;
      • Grayscale + Premultiplied Alpha: 16, 24, 32 bpp;
      • RGB + Premultiplied Alpha: 32, 48, 64 bpp;
      • Lab + Extra: 8, 12, 16 bpc;
      • CMYK + Extra: 8, 12, 16 bpc;
      • Grayscale + Premultiplied Alpha + Extra: 8, 12, 16 bpc;
      • RGB + Premultiplied Alpha + Extra: 8, 12, 16 bpc;

    ImageGear Filter Control Parameters

    Filter Control Parameter Type Default Value Available Values Description
    BigEndian bool false

    false,

    true

    If true , big endian order is used for write operation ("MM"), in other case little endian is used("II").
    BitonalPaletteMode ImGearTIFFBitonalPaletteMode Enumeration LEGACY An ImGearTIFFBitonalPaletteMode Enumeration value Specifies whether ImageGear shall fix strange looking palettes when reading bitonal TIFF images.
    FillOrder ImGearFillOrder Enumeration MSB An ImGearFillOrder Enumeration value Specifies fill order to use for writing the TIFF file. Should always be set to MSB (default); LSB is okay only for special circumstances and only for ImGearCompressions CCITT_G3, CCITT_G4, CCITT_C32D, HUFFMAN, and NONE.
    ImageBeforeIFD 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.
    IncludePageNumber bool true false, true If this parameter is true then include tag 297 into TIFF image with real value of page number.
    LoadFirstUnknownChannelAsPAlpha bool true true, false This parameter specifies how to load first extra channel if ExtraSamples tag is missing. If LoadFirstUnknownChannelAsPAlpha is True, IG 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, IG loads all extra channels as extra channels.
    MissingCompression ImGearCompressions Enumeration AUTO An ImGearCompressions Enumeration value Compression to use for image loading, if compression tag is missing in the image.
    Save70 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.
    SaveClassF bool false false, true If this value is true then image to be written in TIFF format compatible with class F requirements.
    SaveEXIFMetadata bool false true, false If this parameter is true EXIF metadata is saved with TIFF file.
    SaveExistingEXIFMetadata bool true true, false

    This parameter controls the saving of existing EXIF metadata.

    By default (SaveEXIFMetadata = False, SaveExistingEXIFMetadata = True), ImageGear saves EXIF metadata if it exists in the source page, and does not save EXIF metadata if it does not exist in the source page.

    SavePlanar bool false false, true Specifies tag value 284 for output image.
    SaveUsingDiffPredictor bool false false, true If this parameter is true, then output TIFF-LZW image will be produced using the horizontal differencing predictor.
    StripBufferSize int 32768 Any positive value If StripMode equals ImGearStripModes Enumeration.FIXED_BUFFER, specifies the buffer size to be used for writing of each strip.
    StripCount int 1 Any positive int value, not greater than image height If StripMode equals ImGearStripModes Enumeration.FIXED_COUNT, specifies the number of strips for saving the TIFF image.
    StripMode ImGearStripModes Enumeration FIXED_COUNT An ImGearStripModes Enumeration value Specifies strip or tile saving mode for the TIFF image. By default, ImageGear saves TIFF files with one strip.
    SubIFDpath string Empty string Any string value Path of the SubIFD to load the image from. If set to empty string (default), load image from root IFD. See "Camera Raw Image support" section for more detail.
    TileHCount int 10 Any positive int value, not greater than image width If StripMode equals ImGearStripModes Enumeration.TILED_FIXED_COUNT, specifies the number of tiles in horizontal dimension.
    TileHeight int 64 Any positive int value, not greater than image height If StripMode equals ImGearStripModes Enumeration.TILED_FIXED_SIZE, specifies the height of each tile.
    TileVCount int 10 Any positive int value, not greater than image height If StripMode equals ImGearStripModes Enumeration.TILED_FIXED_COUNT, specifies the number of tiles in vertical dimension.
    TileWidth int 64 Any positive int value, not greater than image width If StripMode equals ImGearStripModes Enumeration.TILED_FIXED_SIZE, specifies the width of each tile.
    TreatThumbnailsAsPages bool false false, true If this parameter is true, ImageGear considers the pages marked with 'NewSubfileType tag is 1' as regular pages. Otherwise, pages with 'NewSubfileType is 1' are considered thumbnails and are not loaded and not taken into account in page count calculation.

    SaveExistingEXIFMetadata works in combination with SaveEXIFMetadata parameter, as shown in the table below:

    SaveEXIFMetadata SaveExistingEXIFMetadata Source Page has EXIF metadata ImageGear Action
    False False No Does not save EXIF metadata
    False False Yes Does not save EXIF metadata
    False True No Does not save EXIF metadata
    False True Yes Saves existing EXIF metadata
    True False No Saves default EXIF metadata
    True False Yes Ignores existing and saves default EXIF metadata
    True True No Saves default EXIF metadata
    True True Yes Saves existing EXIF metadata

    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 what "class" the TIFF belonged to. The classes are: TIFF-B-monochrome, TIFF-F-fascimile, 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).

    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.