![]() The file format does not support the requested metadata.Ĭase unchecked((int)0x88982F81): // WINCODEC_ERR_UNSUPPORTEDOPERATION If (retrievedProps.ContainsKey("/xmp/dc:creator"))Ĭreator = (string)retrievedProps.Value Ĭase unchecked((int)0x88982F41): // WINCODEC_ERR_PROPERTYNOTSUPPORTED Orientation = (ushort)retrievedProps.Value Requests.Add("/xmp/dc:creator") // WIC metadata query for Dublin Core creator Requests.Add("") // Windows property key for EXIF orientation private async void ReadImageMetadata(BitmapDecoder bitmapDecoder) The properties are returned in a dictionary of key/value pairs containing the property name or path and the property value. Call the BitmapPropertiesView.GetPropertiesAsync method on the decoder's BitmapProperties member to request the specified properties. Once you have the decoder, create a list of strings and add a new entry for each metadata property you want to retrieve, using either the Windows Property identifier string or a WIC metadata query. For information on how to do this, see Imaging. ![]() ![]() Reading image metadata using this technique requires you to have a BitmapDecoder that was created with the source image file stream. For these operations you can use Windows Properties to specify the data you are reading or writing, but you can also use the metadata query language provided by the Windows Imaging Component (WIC) to specify the path to a requested property. The most advanced way of working with image data is to read and write the properties on the stream level using a BitmapDecoder or a BitmapEncoder. Geopoint geoPoint = await GeotagHelper.GetGeotagAsync(imageFile) To get a GeoPoint representing the geotagged location of an image file, call GetGeotagAsync. You must call RequestAccessAsync before calling SetGeotagFromGeolocatorAsync to ensure the user has granted your app permission to use their location.įor more information on the geolocation APIs, see Maps and location. You must include the location device capability in your app manifest in order to use the SetGeotagFromGeolocatorAsync API. If (accessStatus = GeolocationAccessStatus.Allowed)Īwait GeotagHelper.SetGeotagFromGeolocatorAsync(imageFile, locator) Var accessStatus = await Geolocator.RequestAccessAsync() To set the geotag data using the device's current location, create a new Geolocator object and call GeotagHelper.SetGeotagFromGeolocatorAsync passing in the Geolocator and the file to be tagged. var point = new Geopoint(Īwait GeotagHelper.SetGeotagAsync(imageFile, point) If you already have a Geopoint object representing the location you want to tag in the image, either from a previous use of the geolocation APIs or some other source, you can set the geotag data by calling GeotagHelper.SetGeotagAsync and passing in a StorageFile and the Geopoint. GeotagHelper is a utility class that makes it easy to tag images with geographic data using the APIs directly, without having to manually parse or construct the metadata format. For a listing of the image metadata supported for each image type, see Photo Metadata Policies.īecause properties that are unsupported may return a null value when retrieved, always check for null before using a returned metadata value. Some properties are only supported for certain file containers and image codecs. If (retrievedProps.ContainsKey(""))Īperture = (double)retrievedProps įor a complete list of Windows Properties, including the identifiers and type for each property, see Windows Properties. IDictionary retrievedProps = await props.RetrievePropertiesAsync(requests) ![]() The ImageProperties.RetrievePropertiesAsync method takes this list of strings and returns a dictionary of key/value pairs where the key is the property identifier and the value is the property value. Create a list of strings and add the identifier for each property you want to retrieve. To access a larger set of file metadata, use the Windows Property System, a set of file metadata properties that can be retrieved with a unique string identifier. Format does not support, or image does not contain DateTaken property Format does not support, or image does not contain Title property private async void GetImageProperties(StorageFile imageFile) The returned ImageProperties object exposes members that contain basic image metadata fields, like the title of the image and the capture date. Get the image-specific properties by calling GetImagePropertiesAsync. The StorageFile.Properties property returns a StorageItemContentProperties object that provides access to content-related information about the file. This article shows how to read and write image metadata properties and how to geotag files using the GeotagHelper utility class. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |