If you would have the possibility to change from INI to XML, then check out
our XmlDocuments component (one unit to add to your "uses" clause).
It would go like this:
procedure AddBitmapToXml(const Filename: string; ABitmap: TBitmap);
Doc := TsdXmlDocument.CreateName('Root');
S := TStringStream.Create('');
with Doc.Root.NodeNew('Bitmap') do
BinaryString := S.DataString;
It puts the binary data in the form of BASE64 encoded data in the XML file.
Other tasks for which one normally uses INI can also be performed with
with ADoc.Root.NodeNew('MyObject') do begin
It has the added advantage that XML has infinite levels instead of the usual
two in INI (section and items), so you can also easily store lists and
More info here: