[UWP]如何获取所有相机/ exif /照片元数据? [英] [UWP]How to get all camera/ exif /photo metadata?

查看:120
本文介绍了[UWP]如何获取所有相机/ exif /照片元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取拍摄照片的所有元数据或拍摄照片之前,如亮度,iso速度,f值,对比度等。


现在我用照片拍照; CapturePhotoToStorageFileAsync(ImageEncodingProperties.CreateJpeg(),photoFile)但在保存的jpg文件中没有获取元数据。


在拍照时还尝试将SoftwareBitmap作为其BitmapPropertySet,但只有相机制造商和型号元数据。

解决方案

你好,


您可以使用 GetImagePropertiesAsync
获取图像特殊属性的方法。要访问大量文件元数据,可以使用Windows Property System,这是一组可以使用唯一字符串标识符检索的文件元数据属性。


 private async Task< IDictionary< string,object>> GetImageProperties(StorageFile imageFile)
{
ImageProperties props = await imageFile.Properties.GetImagePropertiesAsync();

var requests = new System.Collections.Generic.List< string>();
requests.Add(" System.Photo.Orientation");
requests.Add(" System.Photo.Aperture");
requests.Add(" System.Photo.ISOSpeed");
requests.Add(" System.Photo.Brightness");
requests.Add(" System.Photo.Contrast");

IDictionary< string,object> retrieveProps = await props.RetrievePropertiesAsync(requests);

返回retrieveProps;
}



有关更多图片特殊属性,请参阅此
部分


处理图片数据的最高级方法是使用  BitmapDecoder
这个
文章
显示了如何阅读Image MetaData。


祝你好运,


罗伊


I need get all metadata of captured photo or before capturing photo, like brightness, iso speed, f-number, contrast and others.

Now I take photo using CapturePhotoToStorageFileAsync(ImageEncodingProperties.CreateJpeg(), photoFile) but get no metadata in saved jpg file.

Also tried get SoftwareBitmap an its BitmapPropertySet when taking photo but there was only camera manufacturer and model metadata.

解决方案

Hello ,

You can use GetImagePropertiesAsync method to get image-special properties. To access a large set of file metadata, you can use the Windows Property System, a set of file metadata properties that can be retrieved with a unique string identifier.

        private async Task<IDictionary<string, object>> GetImageProperties(StorageFile imageFile)
        {
            ImageProperties props = await imageFile.Properties.GetImagePropertiesAsync();

            var requests = new System.Collections.Generic.List<string>();
            requests.Add("System.Photo.Orientation");
            requests.Add("System.Photo.Aperture");
            requests.Add("System.Photo.ISOSpeed");
            requests.Add("System.Photo.Brightness");
            requests.Add("System.Photo.Contrast");

            IDictionary<string, object> retrievedProps = await props.RetrievePropertiesAsync(requests);

            return retrievedProps;
        }

For more image-special properties, you can refer to this section.

The most advanced way of working with image data is to read the properties on the stream level using a BitmapDecoder. This article shows how to read Image MetaData.

Best regards,

Roy


这篇关于[UWP]如何获取所有相机/ exif /照片元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆