This exercise also shows the importance of agreeing on standards for compressed files, so that a file compressed on one computer can be decompressed on another.
In this case, you need to know the order (left to right), and that the first pixel in each row is white.
The version of run-length encoding (RLE) used in this exercise above only works well for black and white images, and isn’t so good for photographs, because the level of colour detail is so accurate that it’s very unlikely that two adjacent pixels are exactly the same colour.
A different method, called JPEG, works particularly well for colour photos.
It finds patterns in the variations of the colours in a photo, and converts the patterns to numbers that are then compressed using RLE.
Both JPEG and MP3 allow images and sound to be recorded on one brand of equipment and played back on a variety of devices.
The form of run-length encoding used in this exercise is most related to the technique used by fax machines, which are based on black and white scanning, but a modified version of RLE is also used in JPEG images.