How is the color of the pixels encoded

Image coding

One way in which computers can save and transfer images works as follows: A rectangular grid is placed over the image and then for each sub-square it is recorded which color prevails in this part of the image. In the coded message, each sub-square is named as a colored point pixel represents. That is why pictures coded in this way are also called Raster graphics or Pixel graphics (see Wikipedia). As an example, the image of the robot bit with different grid sizes:

As with all other codes, a code table is required to code the colors. It assigns a binary code to all colors. The corresponding code table in the mobile phone of the three robots is not very large, because the mobile phone of the robot can only display images with a maximum of eight colors:

White0000
black0001
red0010
green0011
yellow0100
brown0101
orange0110
blue0111

Thus, every four bits of the coded message correspond to one pixel in the decoded image.

Image compression

Coding images can take up a lot of space if the grid is very large and therefore many pixels have to be coded. Here it would be very practical if the image could be compressed. The compression process of the three robots' mobile phones takes advantage of the many images that they often contain large areas of the same color. The coding of such areas is relatively monotonous: one pixel of the same color follows the next. If people had to convey such a picture to themselves, they would not say stubbornly "green, green, green, green ..." but they would probably shorten it with "now there are 5 green pixels, then 20 yellow, then ...".

This one trick can also use the three robots' mobile phones. If several pixels of the same color follow one another in an image, this can be coded accordingly. In addition to the 8 color values, there are also 8 repetition instructions in the code table:

White00002 pixels1000
black00013 pixels1001
red00104 pixels1010
green00105 pixels1011
yellow01006 pixels1100
brown01017 pixels1101
orange01108 pixels1110
blue01119 pixels1111

Eight yellow pixels can thus be coded to save space as follows:

example

The following example shows step-by-step how compressed images can be decoded. The compressed image looks like this:

111000101001001010000000100100101001001010000000100100
100010110000000010001011000000001010010010100000001001
001010010010100000001001001011100010

Since the image is compressed, it is not immediately apparent how big the image is. The first step is to decompress the message:

111000108 pixels red
100100103 pixels red
100000002 pixels white
100100103 pixels red
100100103 pixels red
100000002 pixels white
100100103 pixels red
00101 pixel red
110000006 pixels white
00101 pixel red
00101 pixel red
110000006 pixels white
00101 pixel red
100100103 pixels red
100000002 pixels white
100100103 pixels red
100100103 pixels red
100000002 pixels white
100100103 pixels red
111000108 pixels red

So the image consists of 64 pixels. Since it has to be square, the image is now recorded in a grid of 8x8 pixels:

Continue to music decoding ...

If you've already found a solution, you can check it out here:

Check solutions