TIFF (Tagged Image File Format) is a flexible, adaptable file format for handling images and data within a single file. TIFF was originally created by Aldus Corporation in 1986 and is now controlled by Adobe Systems. It remains one of the most widely supported and versatile image formats.
- Dimensions: Variable (no limits in specification)
- Color Depth: 1 to 64 bits per channel
- Compression: Multiple options (uncompressed, LZW, PackBits, JPEG, ZIP, etc.)
- Magic Bytes:
- Little-endian:
0x49 0x49 0x2A 0x00("II*\0") - Big-endian:
0x4D 0x4D 0x00 0x2A("MM\0*")
- Little-endian:
- File Extension: .TIF or .TIFF
- Platform: Cross-platform (Windows, Mac, Linux, Unix)
- Year: 1986 (ongoing revisions)
- Developer: Originally Aldus Corporation, now Adobe Systems
TIFF was designed to become the standard for storing scanned images and has grown to support a wide variety of image types including:
- Bilevel (black and white)
- Grayscale
- Palette color
- Full color (RGB)
- CMYK (for printing)
- Lab color
- YCbCr
The format's flexibility made it popular for:
- Desktop publishing
- Document imaging and archiving
- Medical imaging (DICOM uses TIFF)
- Geospatial data (GeoTIFF)
- Professional photography
TIFF files are organized using a tag-based structure:
Offset Size Description
------ ---- -----------
0x00 2 Byte order (II = little-endian, MM = big-endian)
0x02 2 Version (always 42, 0x002A)
0x04 4 Offset to first IFD (Image File Directory)
var var Image data and IFDs
An IFD contains information about the image:
- Image dimensions
- Color space
- Compression type
- Bits per sample
- Photometric interpretation
- Strip/tile organization
- And many other optional tags
- ImageWidth (256): Width of the image in pixels
- ImageLength (257): Height of the image in pixels
- BitsPerSample (258): Number of bits per channel
- Compression (259): Compression scheme used
- 1 = No compression
- 2 = CCITT Group 3
- 5 = LZW
- 32773 = PackBits
- 7 = JPEG
- 8 = Deflate (ZIP)
- PhotometricInterpretation (262): Color space
- 0 = WhiteIsZero
- 1 = BlackIsZero
- 2 = RGB
- 3 = Palette color
- 4 = Transparency mask
- 5 = CMYK
- StripOffsets (273): Byte offset of each strip
- SamplesPerPixel (277): Number of channels
- RowsPerStrip (278): Number of rows per strip
- StripByteCounts (279): Byte count for each strip
TIFF supports numerous color modes:
- Black and white images
- Each pixel is 1 bit
- Common in document scanning
- Shades of gray
- 8-bit: 256 levels
- 16-bit: 65,536 levels (for high dynamic range)
- Indexed color using a color palette
- Up to 256 colors typically
- Full color images
- 24-bit: 8 bits per channel (R, G, B)
- 48-bit: 16 bits per channel (for high color depth)
- For printing and prepress
- Cyan, Magenta, Yellow, Black channels
- RGB with alpha transparency channel
TIFF supports multiple compression algorithms:
- Uncompressed pixel data
- Large file sizes but fast to decode
- Lossless
- Simple run-length encoding
- Same algorithm used in MacPaint
- Lossless
- See MAC.md for PackBits details
- Lempel-Ziv-Welch compression
- Lossless
- Good compression for most images
- Patent issues resolved (expired)
- Lossy compression
- Used for photographic images
- Can achieve high compression ratios
- Quality/size tradeoff
- Lossless compression
- Similar to PNG compression
- Good compression for most images
- Fax compression
- For bilevel (1-bit) images
- Lossless
In the Vintage Image Viewer, TIFF files are decoded using PIL's native TIFF support:
def decode(file_path):
# Use PIL's native TIFF support
img = Image.open(file_path)
# Convert to RGB if needed for consistent display
if img.mode in ('RGBA', 'P', 'LA'):
img = img.convert('RGB')
elif img.mode not in ('RGB', 'L', '1'):
# Convert any other modes to RGB
img = img.convert('RGB')
return imgPIL/Pillow automatically handles:
- All standard TIFF compressions
- Multiple color modes
- Big-endian and little-endian byte orders
- Multi-page TIFF files
- Various bit depths
See vintage_image_viewer.py:
TIFImageDecoder.decode()- TIFF decoder using PIL
- Universal support: Widely supported across platforms and applications
- Flexible: Supports many color modes and bit depths
- High quality: Lossless compression options preserve image quality
- Metadata: Extensive tag system for storing image information
- Multi-page: Can store multiple images in one file
- Professional: Industry standard for publishing, printing, archiving
- File size: Uncompressed or losslessly compressed files can be large
- Complexity: Tag-based structure more complex than simpler formats
- Compatibility: Some TIFF features not supported by all readers
- No animation: Unlike GIF, does not support animation
- Document scanning: Standard format for scanned documents
- Professional photography: RAW conversions and master files
- Printing and prepress: CMYK color space support
- Archival: Lossless storage of important images
- Medical imaging: DICOM standard uses TIFF
- Geospatial: GeoTIFF for geographic data
TIFF has historical connections to some vintage formats supported by this viewer:
- TIFF compression type 32773 uses PackBits
- Same algorithm as MacPaint (.MAC format)
- See MAC.md for details
- More advanced than RLE compression in .ART, .PIC, .PCX
- Replaced simple RLE in professional applications
Quick identification of TIFF files:
# Check magic bytes (little-endian)
xxd -l 4 file.tif
# Should show: 4949 2a00 (II*\0)
# Or big-endian:
# Should show: 4d4d 002a (MM\0*)
# Python detection
with open('file.tif', 'rb') as f:
magic = f.read(4)
is_tiff = (magic == b'II*\x00' or magic == b'MM\x00*')- Extended TIFF for files > 4GB
- Uses 64-bit offsets instead of 32-bit
- Supported by modern software
- TIFF with georeferencing information
- Used for satellite imagery and maps
- Stores coordinate system and projection data
- TIFF for Electronic Photography
- Used in digital cameras
- Supports camera-specific metadata
- Adobe's open RAW image format
- Based on TIFF/EP
- Stores camera RAW data
- Official Specification: TIFF Revision 6.0 (1992)
- Current Maintainer: Adobe Systems
- Standards: ISO 12639:2004 (Electronic imaging)
- PNG: Simpler lossless format with alpha transparency
- JPEG: Lossy compression for photographs
- BMP: Windows bitmap (simpler, uncompressed)
- PCX: Earlier DOS format (.PCX)
- GIF: Indexed color with animation
Last updated: 2025-11-04