Board index » delphi » TBitmap.Save to file

TBitmap.Save to file

Hi,

I am trying to save a TBitmap to file but I need to specify the number of
colours. Does anyone have any Idea on how to do this?

Thanks
--

Tox
---------------------------------------------------------------------
Two men walk into a bar one after the other, you would have thought
that the second guy would have been smarter.
---------------------------------------------------------------------
This item was brought to you by the letters E and B and the number 7

 

Re:TBitmap.Save to file


Quote
Brad (eeva...@cc.curtin.edu.au) wrote:

: Hi,

: I am trying to save a TBitmap to file but I need to specify the number of
: colours. Does anyone have any Idea on how to do this?

: Thanks

Well, I am searching for a solution to this same problem.  I do a bunch
of drawing to the bitmap's canvas using canvas drawing methods, then a
savetofile, and it always ends up with the same color resolution as
whatever the display device is set to.  I believe this is because the
display context encapsulated by the bitmap.canvas is "compatible" with
the screen.

I don't know of a way around this except to create your own device
context using the DIB driver ( CreateDC ("DIB.DRV",...&bmpinfo)) and
use good ol GDI functions to draw to the resulting DC.

Unfortunately this means rewriting all the easy delphi canvas drawing
code with windows GDI code.

If I'm wrong, or anyone knows of a better way, I'd love to read it here.
Something like, "I've got a TDib component with source that does
exactly what you want!" would be welcome news....

Good Luck,
David K.

--
------------------------
-- David Kirkpatrick  --
-- Southwest Software --
-- dav...@csn.org     --

Re:TBitmap.Save to file


Quote
"Brad" <eeva...@cc.curtin.edu.au> wrote:
>Hi,
>I am trying to save a TBitmap to file but I need to specify the number of
>colours. Does anyone have any Idea on how to do this?
>Thanks
>--
>Tox
>---------------------------------------------------------------------
>Two men walk into a bar one after the other, you would have thought
>that the second guy would have been smarter.
>---------------------------------------------------------------------
>This item was brought to you by the letters E and B and the number 7

Hi

I had to build a C++ DLL in order to save bitmaps with only 16 colors.
(named SAVE16.DLL)
In the DLL, a DIB was created and painted before saving.
It's not a pretty way, but I was late and
I've never heard another solution.
If you will, thanks to tell me.

Regards.

Jean-Louis
http://www.worldnet.fr/~jppat

Other Threads