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
Anonymous
May 11, 2004
not bieng a programmer, and this is just a guess, but this is why i haven't been able to get the signature back into an sql database? if that is so, what use does this snippet have for me?Anonymous
January 21, 2009
PingBack from http://www.keyongtech.com/1234494-converting-picturesAnonymous
December 04, 2013
If you find Ink Control not working in InfoPath Filler, then try below method. blog.ksenthil.net/.../one-or-more-activex-controls-could-not-be-displayedinfopath-ink-control-not-working