Metadata Editor

EXIF EditorEXIF ReaderRemove MetadataGuidesGlossaryAbout

Compression: the tag a TIFF decoder trusts blindly

At a glance

ExifTool tag namesEXIF:Compression
Tag ID / location0x0103
CategoryImage & file structure
Example valueLZW (5)
On metadata-editor.comShown in the EXIF reader, editable in the EXIF editor (JPEG, TIFF)

In a TIFF, Compression (0x0103, IFD0) tells the decoder how the strips or tiles of pixel data are encoded, and the decoder believes it. In a JPEG it usually describes only the embedded thumbnail in IFD1, since the main image is JPEG by definition. Camera JPEGs normally have no Compression tag in IFD0 at all.

ValueExifTool printsWhere you see it
1UncompressedPlain TIFF
5LZWTIFF exports, scanners
6JPEG (old-style)EXIF thumbnails in IFD1
7JPEGJPEG-compressed TIFF
8Adobe DeflateZIP option, convert -compress zip
32773PackBitsSimple run-length encoding

ExifTool's full table lists 53 codes, many of them for raw formats (34713 is Nikon NEF Compressed) or fax variants. Code 32946 is the older Deflate value.

The choice matters for file size. One 1200x800 photo saved by Pillow came to 2,880,140 bytes uncompressed, 1,424,644 with LZW and 759,206 with Adobe Deflate. PackBits made it bigger: 2,901,408 bytes. Run-length encoding has nothing to work with in photographic noise.

Changing the value does not recompress

The tag is a label. Rewrite it on a TIFF and the data is decoded with the wrong algorithm. ExifTool catches some cases: -Compression#=1 on an LZW file stopped with "Undersized IFD0 StripByteCounts". It does not catch this one: -Compression=1 without the # is matched against the printed names, landed on CCITT 1D and wrote 2. Pillow then refused to decode the file. Always use # (or -n) when you write numeric codes.

To actually change compression, re-save the image:

convert scan.tif -compress lzw scan_lzw.tif
exiftool -G1 -s -n -Compression scan_lzw.tif
[IFD0]          Compression                     : 5

The EXIF reader shows Compression, and the editor can write it for JPEG and TIFF. On a TIFF, treat it as read-only unless you are repairing a file whose tag is known to be wrong. The EXIF data guide explains IFD0 and IFD1.

Related fields

Other Metadata Tools