【问题标题】:Read extended image properties from jpg file从 jpg 文件中读取扩展图像属性
【发布时间】:2016-04-06 18:17:50
【问题描述】:

我想读取 jpg 文件的属性。 以下是我到目前为止所做的,但我无法获得如图所示的属性“A”。我从下面的函数中得到的只是带有 ASCII 和数值的字符串列表。

    static void ReadProperties(Image imgImage)
    {
        var listImageProperties =new List<string>();
        try
        {
            PropertyItem[] propItems = imgImage.PropertyItems;

            foreach (PropertyItem propItem in propItems)
            {
                listImageProperties.Add("0x" + propItem.Id.ToString("x"));
                listImageProperties.Add(propItem.Type.ToString());
                listImageProperties.Add(propItem.Len.ToString());
            }
        }
        catch (Exception ex)
        {

        }
    }

【问题讨论】:

  • 请注意,“属性”是一个文件系统概念,与 Exif 无关。如果您还想从图像中读取 Exif 信息,请查看我的 metadata-extractor 库,它将从您的图像和视频文件中读取各种元数据。

标签: .net c#-4.0 exif system.io.file


【解决方案1】:

经过一番调试,我得到了答案。 以下代码读取文件属性。

var info = new FileInfo(path);
var att= info.Attributes;//Attributes are enum for ReadOnly, Archive... & so on.

【讨论】:

    猜你喜欢
    • 2018-07-08
    • 2010-11-14
    • 2021-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-18
    • 1970-01-01
    相关资源
    最近更新 更多