Get width and height of an image taken from the pc RRS feed

  • Question

  • Hello,

    I have the following code to open an image from the picture library:

    FileOpenPicker opener = new FileOpenPicker();
    opener.ViewMode = PickerViewMode.Thumbnail;
    opener.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
    // Open the file picker
    file = await opener.PickSingleFileAsync();
    if (file != null)
         // Create stream.
         var stream = await file.OpenAsync(FileAccessMode.Read);
         // Rewind stream to start.
         var bpWithHDR = new BitmapImage();
         await bpWithHDR.SetSourceAsync(stream);
         img.Source = bpWithHDR;

    But when I try to get for example the height:

    double h = img.Height;

    I'm getting the height of the Image control, but I want the height of the real image. How can I do that?


    Thursday, May 22, 2014 9:03 PM


All replies