The BGR233 Image Format

This page describes the BGR233 (also called RGB233) image format. It's a rather unusual and specialized format, with exactly two things going for it:

Actually, the BGR233 format could be thought of as just a way to specify a known, named, palette for a regular 256-color indexed color mode. That is not how it's typically used though, but of course it could be implemented that way on indexed hardware.

Bit Allocation

The format's name comes from the way the bits are allocated to represent color. Of the eight bits used for each pixel, the red and green components use three bits each, with the remaining two bits used for blue.

Bit 7 6 5 4 3 2 1 0
Holds b1 b0 g2 g1 g0 r2 r1 r0

The table above illustrates this allocation of bits, showing how each of the eight bits is holding a bit in one of the three color components. The order of the bits gives the BGR233 name, but of course it's more or less arbitrary and could just as well be RGB332.

The reason the blue component is the one that is given one less bit is that the human eye is considered less sensitive to hues of blue.

Combinatorics

The way the bits are allocated means that BGR233 is capable of expressing seven distinct hues of pure red or pure green, but only three of pure blue. These are shown below, with the value of each component shown in binary:

ValueBlueGreenRed
0 00 000 000
1 01 001 001
2 10 010 010
3 11 011 011
4 100 100
5 101 101
6 110 110
7 111 111

The above table can help in understanding why the total number of colors possible is 256. To select a color, you first need to select one of the four possible values for blue, then one of the eight possible values for green, and finally one of the eight possible values for red. The total number of combinations is then 4×8×8 = 256.

Since the ranges of each of the three color components (red, green and blue) are different in BGR233, it's quite hard to form an even-looking grayscale gradient. These are the three pure grays that are available:

BrightnessBlueGreenRedBGR233 Pixel
0 00 000 000 00
1 01 010 010 52
2 10 100 100 a4
3 11 111 111 ff

The Full Palette

Here is one way of visualizing all the 256 colors that the BGR233 format can express. You can mouse over the cells to update the details in the box on the right.

00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f
80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f
90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f
a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af
b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf
c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf
d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df
e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef
f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff
BGR233 Color 0x00
Binary 00_000_000
Components
B G R
Binary 00 000 000
Intensity 0% 0% 0%
As 8-bit 00000000 00000000 00000000
As RGB888 0x000000

The text in each cell is the corresponding pixel's value in hexadecimal form. Each eight-bit value is represented as two hexadecimal digits. The bit-ordering, as elsewhere on the page, is BGR233.

For display purposes, each color has been converted to a full RGB888 color by repeating the most significant bits of each component as many times as possible. This turns the general BGR233 color b1b0g2g1g0r2r1r0 into the rather unwieldy r2r1r0r2r1r0r2r1g2g1g0g2g1g0g2g1b1b0b1b0b1b0b1b0.