2

Is it possible to create a System.Windows.Media.Imaging.Bitmapsource from a System.Drawing.Bitmap without a reallocation? Unfortunately all methods described in other post included a copy of the pixel data which is not always needed and very expensive...

Nicolas Dias
  • 641
  • 11
  • 22
smedasn
  • 1,249
  • 1
  • 13
  • 16
  • 1
    As far as I can tell the only way is to create a `MemoryStream`, saving the bitmap to the stream and getting ImageSource from that stream. I never found any other way to do so. I have seen people using some extra libraries but I think those are based on the same principle. – StijnvanGaal Nov 24 '15 at 14:02

1 Answers1

1

I found this solution and it worked perfectly for me!

WpfImage.Source = new SharedBitmapSource(DrawingBitmap);
Community
  • 1
  • 1
smedasn
  • 1,249
  • 1
  • 13
  • 16