Board index » delphi » 16 Color BitMap

16 Color BitMap

Hello,

        I have faced a problem that I want to save a 16-colors BMP file
as another Application cannot recognize a 256-colors BMP correctly.
However, the Delphi's SaveToFile() Function cannot be specified the no.
of bits per pixel and I don't want to use GDI to write the code also
don't want to lower the no.of colors available in the window. Would
anyone has some idea on it to do that simply ?

Thank you very much.

Paul

 

Re:16 Color BitMap


In article <31DB0218....@hkstar.com>, jack...@hkstar.com says...

Quote

>Hello,

>        I have faced a problem that I want to save a 16-colors BMP file
>as another Application cannot recognize a 256-colors BMP correctly.
>However, the Delphi's SaveToFile() Function cannot be specified the no.
>of bits per pixel and I don't want to use GDI to write the code also
>don't want to lower the no.of colors available in the window. Would
>anyone has some idea on it to do that simply ?

>Thank you very much.

>Paul

I don't know anything about Delphi but in general you can write a Bmp
file yourself. In the header portion you declare the color bits per
pixel. You then write out your color palette. In your case it would be
a 16 RGB quad values for palette, followed by the bitmap of half-bytes
pixel lookup indexes.
Your problem though wold be to convert 256 color into 16 color.
You could use GetNearestPaletteIndex call?
.
Martin
Quote

s

Other Threads