Share via


Decoding the InfoPath picture format (also Ink Picture)

InfoPath provides two controls which saves pictures inside the XML form (rather than linking to it). When trying to process this XML file outside of InfoPath, you will need to translate the data back into the image binary. InfoPath picture control data and ink picture control data is stored in the XML as base64 encoded data. You will need to decode the base64 picture into binary before it is usable.

Below is a code sample in C# that will do it:

byte[] image = Convert.FromBase64String( s );
MemoryStream memStr = new MemoryStream();
memStr.Write( image, 0, image.Length );
Image img = Image.FromStream( memStr );
img.Save( filename );

Comments