Main page > File formats > Images

TIFF: Tagged Image File Format—A technical overview

General information

Typical file name extensions
.tif
.tiff
Magic bytes
At file offset 0x00 either 0x49 0x49 0x2a 0x00 (“II” for Intel byte order files) or 0x4d 0x4d 0x00 0x2a (“MM” for network / Motorola byte order files). Also see the file structure section.
MIME type
image/tiff

History

TIFF, the Tagged Image File Format was designed by the companies Aldus and Microsoft in the 1980s to store pixel image data.

The format was designed to be extensible. A number of specifications have made use of that property, adding features over time. Unfortunately, the flexibility of TIFF has become a compatibility problem. No single software package is capable of reading all valid TIFF files.

File structure

The only part in a TIFF file which is positioned at a fixed location is the header at its very beginning. It is eight bytes large. First come two bytes which identify the byte order. They must be either both 'I' (for Intel byte order) or both 'M' (for Motorola byte order, also known as network byte order). Next comes a 16 bit integer stored in the byte order indicated by the previous two bytes. It stores the constant value 42dec. The last four bytes must be interpreted as a 32 bit integer value referencing the offset of the first image file directory.

An image file directory (IFD) is a variable-sized data structure within a TIFF file containing all information on one image stored in that TIFF file. An arbitrary number of images can be stored in a TIFF file, an equal number of IFDs must be present to describe each one of them.

An IFD starts with a 16 bit integer value storing the number of tags. For each tag, a twelve byte data structure is stored. At the end of the IFD follows the absolute file offset to the next IFD or zero if that IFD was the last one in the file. The IFDs thus form a linked list of directories.

The tags each describe one property of the image to which the tag belongs. Tags have an ID number, a type and a four byte value field. If the type does not fit into four bytes, that value is interpreted as a file offset in the TIFF file. At that offset, the actual tag information can be retrieved. Some tags are mandatory, like those describing where the image data is located. Others are optional.

Limitations

All file offset values are 32 bit integers, restricting referenced data to two or four gigabytes, depending on whether the integers are interpreted as signed or unsigned. A workaround for larger TIFF files can be found at the Awaresystems site linked to below under Websites.

Text meta data must be ASCII, not allowing for special characters used in many natural languages.

Compression types

The TIFF specification defines a number of compression types, both lossy and lossless, although TIFF is commonly perceived as a lossless file format. Compression types include uncompressed, run length encoding (called PackedBits), LZW, Deflate, various Huffman encoding schemes for bilevel fax images, etc.

Image types

TIFF can support about any type of image data, including the usual standards like bilevel, grayscale, paletted and truecolor images in various bit depths. Types for floating-point samples are supported as well.

Popularity

High. Standard file format for document imaging. Also popular with image editing software.

TIFF and other formats

The EXIF header, an optional data structure within JPEG files, makes use of TIFF's image file directory structure.

The Pegasus Imaging corporation once had software write IMJ image files. That IMJ format was a TIFF file with the .imj file extension and a proprietary compression type.

Metadata

TIFF has various string (text) tag types used to store meta data, including creation software, artist, scanner type and so on. More such tags could be added by defining new tag types.

Libraries

Software

Most imaging software packages understand TIFF. However, it can be difficult to track down software to read exotic flavors of the format. When encountering a TIFF file which cannot be loaded with available software packages, it's a good idea to find out what software was used to create that particular file. A utility like tiffdump can be used to find out whether the file has a Software text marker in it revealing the software's name. It may be possible to download a trial version of that software in order to access the image data.

Specification

The official specs can be found at Adobe's TIFF resources page (see the Websites section below). The last version dates back to 1992. Since then, two “technical addendums” have introduced some minor additional features to the format. These documents can also be found on Adobe's site.

Websites