I have InkPresenter related to the StrokeCollection in the MVVM model that I use for the signature panel. Before sending the data back to the server, I want to convert the StrokeCollection data to PNG, this is what I have (I use the ImageTools library):
// Signature is a StrokesCollection var bounds = Signature.GetBounds(); var inkSignature = new InkPresenter {Height = bounds.Height, Width = bounds.Width, Strokes = Signature}; var wbBitmap = new WriteableBitmap(inkSignature, null); var myImage = wbBitmap.ToImage(); byte[] by = null; MemoryStream stream = null; using (stream = new MemoryStream()) { PngEncoder png = new PngEncoder(); png.Encode(myImage, stream); }
The stream is always just full 0, I feel that I am missing something really simple that I did not think about. Any ideas?
source share