“6.3 Header Data Structure 6.3.1 Multi-byte Integer format The WBMP image encoding uses a multi-byte representation for integer values. A multi-byte integer consists of a series of octets, where the most significant bit is the continuation flag, and the remaining seven bits are a scalar value. The continuation flag is used to indicate that an octet is not the end of the multi-byte sequence. A single integer value is encoded into a sequence of N octets. The first N-1 octets have the continuation flag set to a value of one (1). The final octet in the series has a continuation flag value of zero. The remaining seven bits in each octet are encoded in a big-endian order, ie, most significant bit first. The octets are arranged in a big-endian order, ie, the most significant seven bits are transmitted first. In the situation where the initial octet has less than seven bits of value, all unused bits must be set to zero (0). For example, the integer value 0xA0 would be encoded with the two-byte sequence 0x81 0x20. The integer value 0x60 would be encoded with the one-byte sequence 0x60.”
Example:
Hex A0
Bin 10100000
Hex 81 20
Flags and seven bit groups
1 0000001
0 0100000
The two groups of seven bits
0000001 0100000
The lower eight bits of that fourteen bit group.
10100000
Which in fact is the original binary!
The quote above is from the documentation about an old monochrome image format known as WBMP. It is used in many older cell phones.
With a full understanding of this format I could even write it with my own C code.
The pixel data itself is stored the exact same way that PBM files have except that in this case bits of 0 are black and bits of 1 are white. I already have code that does this that I use for the BMP and TIFF formats.
The multibyte integer format is only required in the header. It seems that it’s an escape from having to decide how many bytes must be used to represent the width and height.