ImageProperties Class

Definition

Provides access to the image-related properties of an item (like a file or folder).

public ref class ImageProperties sealed
class ImageProperties sealed
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class ImageProperties
Public NotInheritable Class ImageProperties
Inheritance
ImageProperties
Attributes
Implements
<xref href="Windows.Storage.FileProperties.IStorageItemExtraProperties?alt=Windows.Storage.FileProperties.IStorageItemExtraProperties&text=IStorageItemExtraProperties" data-throw-if-not-resolved="True"/>

Windows 10 requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

This example demonstrates how to retrieve properties of a file, including image properties like DateTaken and Rating.


try
{
    StorageFile file = rootPage.sampleFile;
    if (file != null)
    {
        StringBuilder outputText = new StringBuilder();

        // Get image properties
        ImageProperties imageProperties = await file.Properties.GetImagePropertiesAsync();
        outputText.AppendLine("Date taken: " + imageProperties.DateTaken);
        outputText.AppendLine("Rating: " + imageProperties.Rating);
    }
}
// Handle errors with catch blocks
catch (FileNotFoundException)
{
 // For example, handle a file not found error
}

var file = SdkSample.sampleFile;
if (file !== null) {
    var outputDiv = document.getElementById("output");

    // Get image properties
    file.properties.getImagePropertiesAsync().done(function (imageProperties) {
        outputDiv.innerHTML += "Date taken: " + imageProperties.dateTaken + "<br/>";
        outputDiv.innerHTML += "Rating: " + imageProperties.rating + "<br/>";
    },
    // Handle errors with an error function
    function (error) {
       // Handle errors encountered while retrieving properties
    });
}

After GetImagePropertiesAsync completes, imageProperties gets a ImageProperties object.

In the example, file contains a StorageFile that represents the file to retrieve properties for.

Remarks

You can access a ImageProperties object asynchronously using the getImagePropertiesAsync method from the Properties property of an item (like a file of folder), or synchronously using the ImageProperties property if it is available. You can get a ImageProperties object using any of the following methods and properties:

Note

Properties that are get or set using a property handler that is defined by another app (like Microsoft Word) may not be accessible. Instead, you can try to get these properties using a file query that is backed by the system index. For more information, see QueryOptions.

For more code samples about accessing properties, see the File access sample.

Properties

CameraManufacturer

Gets or sets the manufacturer of the camera that took the photo.

CameraModel

Gets or sets the model of the camera that took the photo.

DateTaken

Gets or sets the date when the image was taken.

Height

Gets the height of the image.

Keywords

Gets the collection of keywords associated with the image.

Latitude

Gets the latitude coordinate where the photo was taken.

Longitude

Gets the longitude coordinate where the photo was taken.

Orientation

Gets the Exchangeable Image File (EXIF) orientation flag of the photo.

PeopleNames

Gets the names of people who are tagged in the photo.

Rating

Gets or sets the rating associated with an image file.

Title

Gets or sets the title of the image.

Width

Gets the width of the image.

Methods

RetrievePropertiesAsync(IEnumerable<String>)

Retrieves the specified properties associated with the item.

SavePropertiesAsync()

Saves all properties associated with the item.

SavePropertiesAsync(IEnumerable<KeyValuePair<String,Object>>)

Saves the specified properties and values associated with the item.

Applies to

See also