Run Length Encoding
What is run-length encoding?
- Run-length encoding (RLE) is a form of data compression that condenses identical elements into a single value with a count
- For a text file, "AAAABBBCCDAA" is compressed to "4A3B2C1D2A"
- The string has four 'A's, followed by three 'B's, two 'C's, one 'D', and two 'A's
- RLE is used in bitmap images to compress sequences of the same colour
- For example, a line in an image with 5 red pixels followed by 3 blue pixels could be represented as "5R3B"