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 (3)
  1. Dylan says:

    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?

  2. Senthil says:

    If you find Ink Control not working in InfoPath Filler, then try below method.…/one-or-more-activex-controls-could-not-be-displayedinfopath-ink-control-not-working

Comments are closed.

Skip to main content