in the sample program i posted earlier, i use CreateDIBSection to create a DIB
when that DIB is created, a pointer to a BITMAPINFO structure is passed
the one i created is 24 bits per pixel
however, you could just as easily create one with 256 colors
you set the biBitCount member to 8 and create a palette
(i think you also call RealizePalette or something to select the palette into the DC - never tried it)
palettes are used for bitmaps that have 1, 2, 4, or 8 bits per pixel
(2, 4, 16, or 256 color images)
for what you are doing, 256 colors is probably enough
it would mean that each pixel has 1 byte instead of 3, as in a 24-bit image
the palette (or "color table") then has an array of RGBQUAD structures - one for each color
each RGBQUAD has 4 bytes (B, G, R, A) - the A (alpha channel) is only used for transparent images
so - for a 256 color palette, 1024 bytes are used
then - the data for each pixel is an index into the palette
if the pixel data byte is 0, the first color in the palette is used
if the pixel data byte is 255, the last color in the palette is used