Delen via


ImageProperties Class

Definition

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

public ref class ImageProperties sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class ImageProperties final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class ImageProperties
Public NotInheritable Class ImageProperties
Inheritance
Object Platform::Object IInspectable ImageProperties
Attributes
Implements

Windows 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
}

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(IIterable<String>)

Retrieves the specified properties associated with the item.

SavePropertiesAsync()

Saves all properties associated with the item.

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

Saves the specified properties and values associated with the item.

Applies to

See also