
How To Convert BMP 24 bit to BMP 8 bit in VB?
You can create a DC at any bit depth, after all it's just changing the
number of bits it takes to store each pixel. The bit depth of the DC is
determined (At least I think this is how it goes, please correct me if I'm
wrong) by the bit depth of the bitmap that's selected into it. You set the
bit depth of that in the BITMAPINFOHEADER structure.
As long as you keep the image as a DIB then you can work at any bit depth
you want, the only time you have to worry about the screen resolution is
when you convert your DIB to a DDB.
To save the image as an 8-Bit bitmap then you write out the DIB information
to a file.
First you have a BITMAPFILEHEADER type, then the BITMAPINFO type which
consists of one BITMAPINFOHEADER followed by the palette as RGBQUAD type
entries.
Finally the image data is written (Remember to DWord align the scan lines
though) out as a byte stream in the case of and 8-Bit image or packed data
in the case of 1 or 4-bit images, and these simply point to a colour in the
palette.
Hope this helps,
Mike
-- EDais --
WWW: http://www.*-*-*.com/