RGB555 Format
RGB555 Format
By Jay
0BBBBBGG GGGRRRRR
Bit 15 is unused and should be set to 0. Each colour value can range from 0 - 31… So a R, G, B
value of 31, 31, 31 represents white. As you can see this is quite different from the usual 24-bit
RGB where the colours range from 0 - 255.
R = R DIV 8 (DIV means integer division: Same as division but any decimals are truncated)
G = G DIV 8
B = B DIV 8
colour = B x 1024 + G x 32 + R
The following example show how to convert white (255,255,255) to the 15-bit format:
R = 255 DIV 8 = 31
G = 255 DIV 8 = 31
B = 255 DIV 8 = 31
colour = B x 1024 + G x 32 + R
colour = 31 x 1024 + 31 x 32 + 31 = 32767
So white as a 15-bit BGR colour is 32767 or 0x7FFF in hex. And to clear up any confusion, YES,
this value will be stored in LSB order (otherwise known as 'bits reversed'). So you will see this as FF
7F in the hex editor.
3) Converting a 15-Bit BGR colour to a 24-Bit colour
To convert a 15-BGR value into 24-RGB values, is simply the reverse operation. The formula is:
R = (colour MOD 32) x 8 (MOD mean modulus: Means divide the number and take the
remainder)
G = ((colour DIV 31) MOD 32) x 8
B = ((colour DIV 1024) MOD 32) x 8
The following example shows how to convert white (32767) to it's respective RGB values:
colour = 32767
So the final output is (248, 248, 248). Uh-oh, 24-bit RGB white is (255, 255, 255) not (248, 248,
248). Apparently, what happened is there was a precision loss during the conversion. Think about
it… if you convert a 24-bit value into a 15-bit you would have loss some precision. Thus, when you
reverse the procedure from 15-bit to 24-bit, the precision is still lost and is unrecoverable. There is
nothing you can do about this precision loss; however, the loss is so minimal you probably won't
notice the difference between (248, 248, 248) and (255, 255, 255) anyways.
4) Palconv.exe
Disclaimer:
I'm not responsible for anything that happens to your computer when using this program. Use at
your own risk.
Palconv.exe is a tool bundled in with this tutorial that converts a palette from one format to another.
The formats supported are RAW 24-bit RGB format, 15-Bit BGR CG format, ZST save states,
MS-RIFF format, and JASC (Paint Shop Pro) palette format. To use, in DOS prompt type:
For example, if you wanted to convert a zsnes savestate call "game.zst" into a JASC palette
"output.pal", then you'd type this: