tags:

views:

51

answers:

1

Classic question - how to load Bitmap Source from file with picture?

A: 

You can read the bytes of the image from disk into a byte array and then create your BitmapImage object.

            MemoryStream stream = new MemoryStream(imageBytes);
            System.Windows.Media.Imaging.BitmapImage img = new System.Windows.Media.Imaging.BitmapImage();
            img.BeginInit();
            img.StreamSource = stream;
            img.EndInit();

            return img;
ChrisNel52