I'm trying to do a super simple thing : get the size of an image.
So I create my BitmapImage
but I'm getting 0 when I try to access the PixelWidth
and PixelHeight
.
How can I accomplish that please?
EDIT: (added sample code)
I'm just doing:
var baseUri = new Uri("ms-appx:///");
var bitmapImage = new BitmapImage(new Uri(baseUri, "Assets/Logo.png"));
MyImage.Source = bitmapImage;
Debug.WriteLine("Width: " + bitmapImage.PixelWidth + " Height: " + bitmapImage.PixelHeight);
In the console, I get:
Width: 0 Height: 0