locked
get image size from url with out downloading the image

    Question

  • Dear team,

    i am using the following code

    {
    BitmapImage btm = new BitmapImage(new Uri("http://anyurl.com/foo.jpg"));
    btm.DownloadProgress += btm_DownloadProgress;
    DummyImage.Source = btm;
    }
    private void btm_DownloadProgress(object sender, DownloadProgressEventArgs e)
        {
            if (e.Progress == 100)
            {
                int width = ((BitmapImage)sender).PixelWidth;
            }
         } 

          it is working fine but i get the result after binding the image. how to get the image width while binding

    kindly help 

    Wednesday, October 08, 2014 3:17 PM

Answers

  • hi i set as

    btm.Stretch=Stretch.None;

    and got the answer

    thanks

    • Marked as answer by mann madhan1 Wednesday, October 08, 2014 6:39 PM
    Wednesday, October 08, 2014 6:39 PM

All replies

  • hi i set as

    btm.Stretch=Stretch.None;

    and got the answer

    thanks

    • Marked as answer by mann madhan1 Wednesday, October 08, 2014 6:39 PM
    Wednesday, October 08, 2014 6:39 PM
  • Thanks for sharing the solution with us :)

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, October 09, 2014 2:23 AM
    Moderator