Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store bitmap in text file

I want to store small bitmaps in a text file similar to the way Delphi does it with it's dfm files.

Is there a function in the RTL or VCL that I could use to do this?

like image 384
jpfollenius Avatar asked Dec 21 '22 13:12

jpfollenius


1 Answers

I suggest that you do the following:

  1. Save to an in memory stream. Use TMemoryStream, and call SaveToStream on the bitmap.
  2. Compress the stream, perhaps using the zlib unit. This step is optional.
  3. Encode the stream using base64. For example you can use the functionality provided by Soap.EncdDecd.

And in the opposite direction, well you just reverse the steps.

like image 185
David Heffernan Avatar answered Dec 24 '22 01:12

David Heffernan