I’m trying to load a BMP image in Windows Phone 7 application but when the extension is. bmp the image does not appear. However, the code works with .jpg, .png and .gif.
I’m using the following code snippet:
Uri uri = new Uri("Images/test.bmp", UriKind.Relative);
ImageSource img = new System.Windows.Media.Imaging.BitmapImage(uri);
imageView.Source = img;
Thanks
Save it as a
png. Silverlight doesn’t supportbmpout of the box (see Silverlight 4 BitmapImage – bmp file support).Alternatively, if you really need to do this, you’ll need to use a third-party library. The .net Image Tools Library has the BMP converters you need. There’s some sample code in this question: Silverlight 4: How can I convert bmp byte array to png byte array?