Bitmap And App.Config file

  • Thread starter Thread starter Polo
  • Start date Start date
P

Polo

Hi All,

How can I load and save a Image (bitmap) in a config application file (xml)

Thank's
 
How can I load and save a Image (bitmap) in a config application file
XML doesn't support storing binary data directly, but you can use Base64
encoding
(e.g. use XmlTextWriter.WriteBase64() method) to store binary data within an
XML document.
When you have a BASE64 encoded image, you could decode it, convert it to a
stream and construct a Bitmap instance using this stream as a parameter.

However, I suggest that you consider storing your image in a resource file
instead, since this type of file is a better choice for storing images.

Anders Norås
blog: http://dotnetjunkies.com/weblog/anoras/
 
Hi,

That is not a very good idea .
he app.config is a text file, not the best way to store an image.

You can store it as a separated file if the image change or as an embedded
resource if the image does not change.


Cheers,
 
Back
Top