Modified Huffman coding

Modified Huffman coding is used in fax machines to encode black-on-white images (bitmaps).

The basic Huffman coding provides a way to compress files with much repeating data, like a file containing text, where the alphabet letters are the repeating objects.

This "alphabet" of only two symbols is too small to apply the Huffman coding directly.

Here is an example taken from the article on run-length encoding: A hypothetical scan line, with B representing a black pixel and W representing white, might read as follows: With a run-length encoding (RLE) data compression algorithm applied to the above hypothetical scan line, it can be rendered as follows: Here we see that we have several different numbers in addition to the two items "white" and "black."

These numbers provide plenty of additional items to use, so the Huffman coding can be directly applied to the sequence above to reduce the size even more.