惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
G
Google Developers Blog
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threat Research - Cisco Blogs
A
Arctic Wolf
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
博客园 - 【当耐特】
AWS News Blog
AWS News Blog
U
Unit 42
V
Vulnerabilities – Threatpost
P
Privacy International News Feed
T
Tor Project blog
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Recorded Future
Recorded Future
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
Latest news
Latest news
GbyAI
GbyAI
S
SegmentFault 最新的问题
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
Hacker News: Ask HN
Hacker News: Ask HN
美团技术团队
N
News | PayPal Newsroom
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The Hacker News
The Hacker News
The GitHub Blog
The GitHub Blog
V
V2EX
N
News and Events Feed by Topic
T
Troy Hunt's Blog
Security Latest
Security Latest
博客园 - 叶小钗
P
Palo Alto Networks Blog

博客园 - meil

DotNet中人民币符号的输出 BAT实现照片文件批量改名 Wicket中JQuery事件绑定失效的解决 软件开发中的完整测试所包括的环节UT、IT、ST、UAT Eclipse中SVN插件的安装方式 从mysql中导出单个表结构和数据 代码帝:一个月10万行代码 PHP中使用mktime获取时间戳的一个黑色幽默 Android开发调试工具ADB的使用 Android系统权限配置 Android程序开发基础之——页面传值 Android程序开发基础之——页面布局 Android程序开发的环境配置 SQLServer2008 动态SQL实践 ASP.net中实现双表格同步缩放不变形 Javascript实现DIV滚动自动滚动到底部 SQL Server 日期格式转换示例大全 TinyMCE使用手册 LINQ中的OrderBy实现多字段升序、降序排序实现
C#下取得Exif中照片拍摄日期
meil · 2015-10-08 · via 博客园 - meil
        /// <summary>
        /// 获取Exif中的照片拍摄日期
        /// </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 "";
        }

posted @ 2015-10-08 14:47  meil  阅读(4359)  评论()    收藏  举报