Explanation of Header Pixel in GIMP created C Header File of an XPM image

后端 未结 1 920
萌比男神i
萌比男神i 2021-01-19 17:25

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:

1条回答
  •  借酒劲吻你
    2021-01-19 18:18

    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.

    0 讨论(0)
提交回复
热议问题