For instance like this?
BitmapImage bmpImage = new BitmapImage(new Uri("http://dantonybrown.com/brownsoft/SweepyCleaner.png"));
MessageBox.Show(bmpImage.PixelWidth.ToString());
That makes perfect sense. The image is loaded on demand, and on the background. You have multiple options here:
Assign the BitmapImage to an Image control. You can access the properties after the ImageLoaded event occured:
BitmapImage bmpImage = new BitmapImage(new Uri("http://dantonybrown.com/brownsoft/SweepyCleaner.png"));
bmpImage.ImageOpened += (sender, args) => Dispatcher.BeginInvoke(() => MessageBox.Show(
bmpImage.PixelWidth.ToString(CultureInfo.InvariantCulture)));
imageCtrl.Source = bmpImage;
Load the BitmapImage with CreateOptions.None. This will still load the image in the background, but you don't have to assign the image to a control before it starts loading:
BitmapImage bmpImage = new BitmapImage(new Uri("http://dantonybrown.com/brownsoft/SweepyCleaner.png"))
{CreateOptions = BitmapCreateOptions.None};
bmpImage.ImageOpened += (sender, args) => Dispatcher.BeginInvoke(() => MessageBox.Show(
bmpImage.PixelWidth.ToString(CultureInfo.InvariantCulture)));