ImageProperties class

ImageProperties class

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

Syntax


public sealed class ImageProperties : IStorageItemExtraProperties

Members

The ImageProperties class has these types of members:

Methods

The ImageProperties class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
RetrievePropertiesAsync Retrieves the specified properties associated with the item.
SavePropertiesAsync() Saves all properties associated with the item.
SavePropertiesAsync(IIterable(IKeyValuePair)) Saves the specified properties and values associated with the item.

 

Properties

The ImageProperties class has these properties.

PropertyAccess typeDescription

CameraManufacturer

Read/write

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

CameraModel

Read/write

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

DateTaken

Read/write

Gets or sets the date when the image was taken.

Height

Read-only

Gets the height of the image.

Keywords

Read-only

Gets the collection of keywords associated with the image.

Latitude

Read-only

Gets the latitude coordinate where the photo was taken.

Longitude

Read-only

Gets the longitude coordinate where the photo was taken.

Orientation

Read-only

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

PeopleNames

Read-only

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

Rating

Read/write

Gets or sets the rating associated with an image file.

Title

Read/write

Gets or sets the title of the image.

Width

Read-only

Gets the width of the image.

 

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.

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
}

After GetImagePropertiesAsync completes, imageProperties gets a ImageProperties object.

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

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Storage.FileProperties
Windows::Storage::FileProperties [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

Windows.Storage.FileProperties
Windows::Storage::FileProperties [C++]

Metadata

Windows.winmd

Attributes

[Version(0x06020000)]

See also

Object
IStorageItemExtraProperties
StorageItemContentProperties.getImagePropertiesAsync method
Windows.Storage.BulkAccess.FileInformation.imageProperties property
Windows.Storage.BulkAccess.FolderInformation.imageProperties property
Windows.Storage.BulkAccess.IStorageItemInformation.ImageProperties property

 

 

Show:
© 2016 Microsoft