LZW
LZW is the LZ78 variant Terry Welch published in 1984 that outputs only dictionary indices (no literal characters), with the dictionary built automatically; it is widely used in GIF and Unix compress.
Purpose
It achieves efficient compression with a simpler pure-index output, and the decoder rebuilds the dictionary automatically with no extra information.
Mechanism
The initial dictionary contains all single characters; while scanning, find the longest matching prefix, output its index, and insert that prefix plus the next character into the dictionary. The decoder builds the same dictionary from the already-decoded content.
Use cases
- GIF image compression
- The Unix compress command
- PDF LZWDecode filter