It is pretty simple, actually. Here is some code that should work. I have not tested it, and I write it on top.
private System.Drawing.Bitmap BitmapFromWriteableBitmap(WriteableBitmap writeBmp) { System.Drawing.Bitmap bmp; using (MemoryStream outStream = new MemoryStream()) { BitmapEncoder enc = new BmpBitmapEncoder(); enc.Frames.Add(BitmapFrame.Create((BitmapSource)writeBmp)); enc.Save(outStream); bmp = new System.Drawing.Bitmap(outStream); } return bmp; }
WriteableBitmap inherits from BitmapSource, which can be stored directly in the stream. Then you create a Bitmap from this thread.
source share