Board index » delphi » Saving Tbitmap without using savetofile

Saving Tbitmap without using savetofile

How do I save and load a tbitmap in a file along with
other information.  This is what I have currently

AssignFile(OutFile, Form1.SaveDialog1.FileName);
rewrite(OutFile,1);
BitmapSize := SizeOf(BackGroundBitmap);
BlockWrite(OutFile, BitmapSize, SizeOf(BitmapSize));
BlockWrite(OutFile, BackGroundBitmap, BitmapSize);

BackGroundBitmap is a Tbitmap
This will just be one of many things written to the file,
otherwise I would just use the SaveToFile method.

 

Re:Saving Tbitmap without using savetofile


"Brent A. Seeley" <sl...@cc.usu.edu> wrote:

Quote
>How do I save and load a tbitmap in a file along with
>other information.  This is what I have currently
>AssignFile(OutFile, Form1.SaveDialog1.FileName);
>rewrite(OutFile,1);
>BitmapSize := SizeOf(BackGroundBitmap);
>BlockWrite(OutFile, BitmapSize, SizeOf(BitmapSize));
>BlockWrite(OutFile, BackGroundBitmap, BitmapSize);
>BackGroundBitmap is a Tbitmap
>This will just be one of many things written to the file,
>otherwise I would just use the SaveToFile method.

Use TBitmap.SaveToStream.  

-Danny

Other Threads