In GIMP, you\'re able to save an image as a C header file. I did so with an XPM file, which looks like the image below:
Each pixel is represented by 3 bytes. These pixels are defined as a character array, named header_data
.
The problem is that not every byte is a printable character that could exist in that header file.
This is solved by only using the printable characters 33
through 97
. That gives 6 bits of information, so every four characters will give 24 bits, which can represent all permutations of 3 bytes.