I have a bitmap that is created in memory (using graphics drawing to add lines etc to it). I can save it no problem using
bmp.Save(@"Path");
I want to display it in my WPF window, the only example I have found which seems to do what I want is
Bitmap bmp = someClass.returnMap(); // returns a Bitmap which has been drawn
bmp.Save(@"Path"); //Just so I know the bitmap isn't null
ImageSourceConverter isc = new ImageSourceConverter();
image.Source = (ImageSource)isc.ConvertFrom(bmp); //I get a null refrence exception here
I have no idea why I am getting a null reference or why there is so much conflicting information when I try and Google this.
Edit Error message as requested
'An exception of type 'System.NullReferenceException' occurred in PresentationCore.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object.
If there is a handler for this exception, the program may be safely continued.'