Universal Windows Platform – Tutorial Insider – JpgInfo

Standard

comentsys.wordpress.com today features a Universal Windows Platform tutorial showing how to create a JpgInfo App which will allow you to Open then view details about a JPG picture.

Details

The Library Class contains a GetProperties method which returns a Dictionary – this uses the GetImagePropertiesAsync method on the Properties of a StorageFile passed into the method, it then uses Reflection to get all the properties with the GetProperties on the PropertyInfo type from the ImageProperties and this is added to the Dictionary Dictionary with the Key as a Label then the Value as the contents of that Property. The OpenAsync method uses a FileOpenPicker to open a “.jpg” file and then selected file is passed into the GetProperties method to return the Dictionary.

The MainPage contains the Open button to allow a JPG Picture to be opened and there’s a ListBox which is populated with image properties by setting the ItemsSource and is a list of the Key and Value from the Dictionary and with a Foreground and Background set in the DataTemplate for the ListBox.

Behind the Scenes

This example was inspired from the Microsoft Universal Windows Platform (UWP) app samples and in particular the Simple imaging example, the purpose of this example was to show how you can extract the Image Properties for a JPG image including the Date Taken and Orientation of the Image this may also contain EXIF information used by many digital cameras, the ideal example to use is a photo taken from a Phone or Camera to see what properties are stored along with the image although there was a single sample provided which is a screenshot from the Big Buck Bunny video from the Blender Foundation.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s