zoukankan      html  css  js  c++  java
  • c#如何读取相机手机的拍摄时间

    /// 获中的照片拍摄日期

    /// </summary>

    /// <param name="fileName">文件名</param>

    /// <returns>拍摄日期</returns>

    private string GetTakePicDate(string fileName)

    {

        Encoding ascii = Encoding.ASCII;

        string picDate;

        FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read);

        Image image = Image.FromStream(stream, true, false);

        foreach (PropertyItem p in image.PropertyItems)

        {

            //获取拍摄日期时间

            if (p.Id == 0x9003) // 0x0132 最后更新时间

            {

                stream.Close();

                picDate =  ascii.GetString(p.Value);

                if ((!"".Equals(picDate)) && picDate.Length >= 10)

                {

                    // 拍摄日期

                    picDate = picDate.Substring(0, 10);

                    picDate = picDate.Replace(":","-");

                    return picDate;

                }

            }

        }

        stream.Close();

        return "";

    }

  • 相关阅读:
    6-stm32 滴答定时器(delay不带中断延时)
    5-stm32 滴答定时器(delay中断延时)
    4- stm32 gpio重映射
    3- stm32 gpio寄存器
    2-stm32 gpio位带
    Linux Command
    DIV+CSS规范命名
    JS事件报错之Cannot set property 'onclick' of null
    创建对象的三种方式
    密码的显示和隐藏
  • 原文地址:https://www.cnblogs.com/fanyf/p/5736304.html
Copyright © 2011-2022 走看看