Warning: include(/include/othersites.inc): failed to open stream: No such file or directory in /home/content/13/11000713/html/imagemaker-webs/discovery/Nav_Top/Tiff_Specs.php on line 48

Warning: include(): Failed opening '/include/othersites.inc' for inclusion (include_path='.:/usr/local/php5_6/lib/php') in /home/content/13/11000713/html/imagemaker-webs/discovery/Nav_Top/Tiff_Specs.php on line 48

Warning: include(/include/menu.inc): failed to open stream: No such file or directory in /home/content/13/11000713/html/imagemaker-webs/discovery/Nav_Top/Tiff_Specs.php on line 49

Warning: include(): Failed opening '/include/menu.inc' for inclusion (include_path='.:/usr/local/php5_6/lib/php') in /home/content/13/11000713/html/imagemaker-webs/discovery/Nav_Top/Tiff_Specs.php on line 49
Tech Notes » TIFF File Format Specifications

Electronic Discovery Software

TIFF (Tagged Image File Format) is a general-purpose, tag-based file format for storing and interchanging raster images. A TIFF file consists of a header, one or more Image File Directories (IFD) and the image data. More than one page can be contained in a file; there is one IFD and one image data block for each image. The header identifies the file as a TIFF file, specifies the byte-order of the data and the location of the first IFD. The IFD contains the number of image tag entries, the tag entries themselves, and the location of the next IFD, if any.

The IFD stores information about the image data in tag entries. The tag entry contains the following fields: a TIFF tag that identifies the field, the field type, and the field value.

The format of the header is as follows:

typedef struct {
    INT byte_order;       // "II" for Intel,
                          // "MM" for Motorola
    INT version;
    LONG dir_pointer;     // Pointer to First IFD

For Motorola formats, all Short and Long values stored in the tags are byte reversed from the Intel format. In the Motorola format, numbers are stored in "big-endian" fashion, with the most-significant byte earlier in the file, similar to the way Motorola processors store information in memory. In the Intel-format, numbers are stored in "little-endian" fashion, with the least-significant byte earlier in the file. Most readers can handle either format. The contents of the image do not change.

The IFD contains a number of tags. The tag format is as follows:

typedef struct tiff_tag {
    short tag_type;
    short data_type;
    LONG length;
    LONG value;

The length value in the tag indicates the number of values in the tag. If all of the values specified in the tag will fit into 4 bytes total, for instance if two WORD values or one LONG value are defined, they are stored in the value element of the structure. Otherwise, the value element of the structure contains the offset in the file where these values may be found.

The following tags are defined for class F TIFF files:

TIFF Tag Type Value Comments
PhotometricInterpretation Short 0 - black is 1 (bit toggled on)
1 - black is 0 (bit toggled off)
Default is 1
Compression Short 1 - No compression
2 - CCITT Group 3, lines start on byte bundary (MH standard)
3 - CCITT Group 3 modified, lines start on bit boundary, line end marked with EOL flag
4 - CCITT Group 4 line difference encoding
5 - LZW compression
0x8005 - PackBits
Group3Options Short 0x0004 - Lines end on byte boundary
0x0001 - 2-dimensional encoding (MR encoding)
This is used as a bit field.
ImageLength Short Number of pixel lines on a page
ImageWidth Short Number of pixel columns on a page
ResolutionUnit Short

Horizontal and vertical resolution unit
1 - none specified
2 - Inches (English units)
3 - Centimeters (SI units)

Default is 2
XResolution Rational Horizontal resolution.
YResolution Rational Vertical resolution
RowsPerStrip Long Number of pixel rows per image strip Our generators default to one strip for the entire image
StripOffsets Long Offsets to start of each strip in the file With only one strip, we need only one value.
StripByteCount Long Number of bytes in each strip With only one strip, there will be only one value.
NewSubfileType Long 0x0001 - The image is a thumbnail of another image in the file
0x0002 - The image is one page of a multi-page document
0x0004 - The image is a transparency mask for another image in the file
This is used as a bit field.
FillOrder Short 1 - bytes not reflected: bits are written (and read) from left to right in the byte (first image bit is bit position 7, 2nd bit is bit position 6, 3rd bit is bit position 5, etc.
2 - bytes reflected: bits are written (and read) from right to left in the byte (first pixel is bit position 0, 2nd pixel is bit position 1, 3rd pixel is bit position 2, etc.
PageNumber 2 Shorts First value is page number (0-based). Second value is number of pages. First page will be page 0 of 4 (e.g.), last page will be page 3 of 4.
SamplesPerPixel Short Number of components (e.g. 1 for grayscale and bilevel, 3 for RGB, 4 for CMYK) in each pixel
BitsPerSample Short Number of bits for each component (e.g. 1 for bilevel, 8 for 24-bit color schemes)

TIFF files intended for FAX transmission normally are normally written Bits reversed, Byte Align EOL, Group 3 format (either 2 or 3). Page numbers may or may not be present. If present, they start at 0. The Resolution unit is always Inches. There may be only one strip per page, or strips may be limited to about 8kb per strip. Lines are sometimes padded (to minimum line lengths), resulting in extra garbage at the end of some lines (sequences of binary 0's) before the terminating EOL. The start of the first line in a strip must contain an EOL. Some formats contain 6 ending EOL's at the end of the page - 6 terminating EOL's indicate page end when transmitting, but have no use in a Tiff file.

There is currently no support for embedding annotations in a TIFF file.

Compression formats:

Tiff Type Compression Tag Options TagFillOrder

Group 3 (MH)


0x0004 (byte align)

reflect bit order

Group 3 2D (MR)


0x0005 (byte align/2D)

reflect bit order

Group 4 (MMR)



reflect bit order

Group 3 (MH) - each line consists of token strings representing alternate run-lengths of white and black. Each line is terminated with an EOL (defined as eleven 0 bits followed by one 1 bit). If byte aligned, then the EOL ends on a byte boundary. If there is a transmission error, then the viewer skips to the next valid EOL to find the start of next line.

Group 3 2D (MR) - After a MH line, there are K differences lines. For standard resolution, K=1, for fine resolution, K=3. Each line starts with a bit indicating what type of line it is: a MH line, or a Differences Line. If there is a transmission error, then the viewer skips to the next valid EOL. Errors will not be fully corrected until the next MH line is encountered.

Group 4 (MMR) - All lines are differences from the line above. The starting line is assumed to be a white line. There are no EOL's, lines are not byte aligned. If there is an error anywhere in the page, all subsequent lines are invalid (up until such time as an 'all White', or 'all Black' line is encountered).

The full TIFF specification (version 6, 1992) is available from Adobe. You will need Acrobat Reader (available here) to view it; the specification file is located here.