ImageProperties
ImageProperties
ImageProperties
ImageProperties
ImageProperties
Class
Definition
Provides access to the image-related properties of an item (like a file or folder).
public : sealed class ImageProperties : IImageProperties, IStorageItemExtraProperties
struct winrt::Windows::Storage::FileProperties::ImageProperties : IImageProperties, IStorageItemExtraProperties
public sealed class ImageProperties : IImageProperties, IStorageItemExtraProperties
Public NotInheritable Class ImageProperties Implements IImageProperties, IStorageItemExtraProperties
// This class does not provide a public constructor.
- Attributes
Device family |
Windows 10 (introduced v10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
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:
- StorageItemContentProperties.getImagePropertiesAsync method, which can be accessed using the Properties property, if it is available.
- FileInformation.imageProperties property
- FolderInformation.imageProperties property
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 CameraManufacturer CameraManufacturer CameraManufacturer CameraManufacturer |
Gets or sets the manufacturer of the camera that took the photo. |
CameraModel CameraModel CameraModel CameraModel CameraModel |
Gets or sets the model of the camera that took the photo. |
DateTaken DateTaken DateTaken DateTaken DateTaken |
Gets or sets the date when the image was taken. |
Height Height Height Height Height |
Gets the height of the image. |
Keywords Keywords Keywords Keywords Keywords |
Gets the collection of keywords associated with the image. |
Latitude Latitude Latitude Latitude Latitude |
Gets the latitude coordinate where the photo was taken. |
Longitude Longitude Longitude Longitude Longitude |
Gets the longitude coordinate where the photo was taken. |
Orientation Orientation Orientation Orientation Orientation |
Gets the Exchangeable Image File (EXIF) orientation flag of the photo. |
PeopleNames PeopleNames PeopleNames PeopleNames PeopleNames |
Gets the names of people who are tagged in the photo. |
Rating Rating Rating Rating Rating |
Gets or sets the rating associated with an image file. |
Title Title Title Title Title |
Gets or sets the title of the image. |
Width Width Width Width Width |
Gets the width of the image. |
Methods
RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>) RetrievePropertiesAsync(IIterable<String>) |
Retrieves the specified properties associated with the item. |
SavePropertiesAsync() SavePropertiesAsync() SavePropertiesAsync() SavePropertiesAsync() SavePropertiesAsync() |
Saves all properties associated with the item. |
SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>) SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>) SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>) SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>) SavePropertiesAsync(IIterable<IKeyValuePair<String, Object>>) |
Saves the specified properties and values associated with the item. |