Full Name | Lempel-Zif-Welch (LZW) compression |
Compression ID | ImGearCompressions.LZW = 8 |
ImageGear Assembly | ImageGear23.Core Assembly |
Bit Depth | 1, 4, 8, 16 bpc |
File Formats | GIF, PDF, PS, TIFF |
IG Platforms Support | WIN32, WIN64, Unix, Unix64, .NET, .NET64, MAC |
LZW compression works by finding patterns of data and assigning codes. It works best on highly-patterned images. Images with irregular patterning, or "noise," are not good candidates for this type of compression.
This compression scheme is "dictionary-based". This refers to the array of codes that identify each data pattern found in the image. The "dictionary" begins with a table that contains a code for each possible value in the image. If LZW compression is used on 8-bit images, a LZW "dictionary" is initialized with codes for 256 (28) values. As the file data is read, new values are added to the table for each unique pattern of data found. In the interest of saving space, the dictionary is not saved with the compressed file. The same dictionary is actually rebuilt when the data is decoded.