Run-length encoding

Common formats for run-length encoded data include Truevision TGA, PackBits (by Apple, used in MacPaint), PCX and ILBM.

This process involves converting the input data into a compressed format by identifying and counting consecutive occurrences of each character.

The steps are as follows: [7] The decoding process involves reconstructing the original data from the encoded format by repeating characters according to their counts.

However, newer compression methods such as DEFLATE often use LZ77-based algorithms, a generalization of run-length encoding that can take advantage of runs of strings of characters (such as BWWBWWBWWBWW).

Run-length encoding can be expressed in multiple ways to accommodate data properties as well as additional compression algorithms.

To overcome this, some run-length encoders separate the data and escape symbols from the run lengths, so that the two can be handled independently.