E. File Formats

TIFF Files Created by Image

Bytes 0-7 contain the TIFF header. Bytes 8-129 contain the TIFF Image File Directory (IFD). Within the IFD, bytes 30-31 contain the image width and bytes 42-43 contain the height. Bytes 130-255 are currently unused and are set to zero. Bytes 256-767 contain a 512 byte header unique to the Image program. Image data starts at byte 768, stored in row order, one byte per pixel. In the case of a stack, there are two or more consecutive images starting at byte 768 and bytes 516-517 contain the number of images (slices). The TIFF color table, if any, follows the image data. It consists of 256 16-bit red values, 256 16-bit green values, and 256 16-bit blue values. Any additional TIFF IFDs (only needed for stacks) follow the color table. Note that the 16-bit integers containing the width, height, and number of images have the opposite byte order as IBM PC and VAX systems.

TIFF files created by image can be read using the Import command by selecting Custom , 8-bits , entering Width and Height , and setting Offset to 768. Slices should be set to one for a single image and to the number of slices for a stack. Note that you have to hold down the option key when selecting the Import command to override Image 's automatic TIFF file detection.

The information provided here should be adequate for writing a program to read a TIFF file created by Image . It is not sufficient for creating TIFF files that Image , or any other program, can read. More detailed information on TIFF is available via anonymous FTP from zippy.nimh.nih.gov, in the directory /pub/nih-image/documents.