locked
how to detect if bimap has metadata

    Question

  • I am developing an image processing application, part of this is to let the user select images to load. I then iterate through the collected files, storing the metadata using the bitmap encoder. Unfortunately if the image does not contain any metadata properties the following line causes an exception. I thought this would just return an empty view which I could check but it bombs out at the first line

                        BitmapPropertySet retrievedProps = await decoder.BitmapProperties.GetPropertiesAsync(requests);
                        if (retrievedProps.Count > 0)
                        {
    I hope someone can suggest an easy way to check for properties


    Mal

    Monday, February 17, 2014 6:23 PM

All replies

  • You can catch the exception.
    Monday, February 17, 2014 6:38 PM
    Owner
  • I Mal,

    Check this article http://msdn.microsoft.com/en-us/library/windows/apps/jj709941.aspx

    They explain how to read metadata from images.


    João Sousa (MCTS) Senior Software Engineer

    Monday, February 17, 2014 10:01 PM
  • I Mal,

    Check this article http://msdn.microsoft.com/en-us/library/windows/apps/jj709941.aspx

    They explain how to read metadata from images.


    João Sousa (MCTS) Senior Software Engineer

    Yes thanks that was my starting point, however, doing this line which is detailed in the link you give results in an exception if there is no metadata present

    var retrievedProps = await decoder.BitmapProperties.GetPropertiesAsync(requests);


    Mal

    Monday, February 17, 2014 11:05 PM
  • You can catch the exception.
    Yes I am doing that but during debugging its a pain because it results in a break. I thought there might be a better way of detecting if there is any metadata present without resorting to catching the exception

    Mal

    Monday, February 17, 2014 11:07 PM