I have a data table in SQL 2008 R2 which is used to store images. There is one column for uploaded image data whose SQL data type is “Image”
On the asp.NET layer I pull data into a dataset and then call GetXml() to get an XML string and then put the xml into a text file for import/export.
The image data is serialized into text but I can’t figure out how it’s encoded.
Original image data in the table: 0x89504E….
Image data in my XML string: iVBORw0KGgo…
I need to recover the String representation of the original 0x89504E…. and I assume that’s HEX. What encoding is the iVBORw0KGgo… ? I can’t find the info anywhere.
The encoding is base64.
The following code takes some binary data, puts it in a DataSet, runs GetXml(), and decodes the string in the XML as base64:
Output: