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...
Asked
Active
Viewed 220 times
2

Nicolas Dias
- 641
- 11
- 22

smedasn
- 1,249
- 1
- 13
- 16
-
1As 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 Answers
1
I found this solution and it worked perfectly for me!
WpfImage.Source = new SharedBitmapSource(DrawingBitmap);