Store bitmap in text file

I want to store small bitmaps in a text file, similar to how Delphi does this with dfm files.

Is there a function in RTL or VCL that I could use for this?

+4
source share
3 answers

I suggest you do the following:

  • Save to stream in memory. Use TMemoryStream and call SaveToStream on the bitmap.
  • Stream compression, possibly with a zlib block. This step is optional.
  • Encode a stream using base64. For example, you can use the functions provided by Soap.EncdDecd.

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

+8
source

Text BinToHex() use the BinToHex() function to format binary data.

+3
source

You can simply use Win32.WriteFile to write the bitmap buffer to a file.

0
source

Source: https://habr.com/ru/post/1446432/


All Articles