Excel catalyst 36th wave of open source - picture Exif information extraction, super-fast, ultra-wide information

Excel catalyst in terms of document processing functions to achieve the ultimate, but in fact, great credit is a reference library wheels of some of the open source community, not exclusive benefit of this post to share with nice wheels to crawl under a picture Exif information.

Excel catalytic function corresponding to achieve this post: 83 Wave - specific information file folder information traversing particular image, audio and video https://www.jianshu.com/p/ad98adc64f0b

Again, of course, try to find something with google, Baidu is very inefficient, find out the code, a lot does not apply, under Tucao Baidu favorite article included CSDN, but feather flock together, garbage garbage, advertising a bitch. Really want to search, recommendations or add site: cnblogs.com.

Formally introduced the protagonist, read the image Exif information, they rely on MetadataExtractor completed, immediately on nuget.
MetadataExtractor library

The method is very simple call, a code completion, other codes are used to extract information, character string processing, collection or the like.

The core code is as follows:

 IEnumerable<MetadataExtractor.Directory> directories = ImageMetadataReader.ReadMetadata(filePath);

The above is the author of the content is extracted as Exif interested, just regular linq and can ease.

   IEnumerable<MetadataExtractor.Directory> directories = ImageMetadataReader.ReadMetadata(filePath);

                string widthStr = directories.Where(s => s.Name != "File").Select(k => k.Tags.FirstOrDefault(t => t.Name == "Image Width")).FirstOrDefault().Description;
                dr[ColNameOfImageWidth] = int.Parse(Regex.Match(widthStr, "\\d+").Value);

                string heightStr = directories.Where(s => s.Name != "File").Select(k => k.Tags.FirstOrDefault(t => t.Name == "Image Height")).FirstOrDefault().Description;
                dr[ColNameOfImageHeight] = int.Parse(Regex.Match(heightStr, "\\d+").Value);

                if (Path.GetExtension(filePath).ToLower() == ".jpg" || Path.GetExtension(filePath).ToLower() == ".jpeg")
                {
                    var maker = directories.Where(s => s.Name != "File").Select(k => k.Tags.FirstOrDefault(t => t.Name == "Make")).FirstOrDefault(x => x != null);
                    if (maker != null)
                    {
                        dr[ColNameOfMake] = maker.Description;
                    }

                    var model = directories.Where(s => s.Name != "File").Select(k => k.Tags.FirstOrDefault(t => t.Name == "Model")).FirstOrDefault(x => x != null);
                    if (model != null)
                    {
                        dr[ColNameOfModel] = model.Description;
                    }

                    var picDate = directories.FirstOrDefault(s => s.Name == "Exif SubIFD").Tags.FirstOrDefault(t => t.Name == "Date/Time Original");
                    if (picDate != null)
                    {
                        string str = picDate.Description;
                        if (!string.IsNullOrEmpty(str))
                        {
                            dr[ColNameOfPicDate] = DateTime.Parse(str.Substring(0, 10).Replace(':', '-') + str.Substring(10));

                        }
                    }

                    var jingdu = directories.Where(s => s.Name != "File").Select(k => k.Tags.FirstOrDefault(t => t.Name == "GPS Latitude")).FirstOrDefault(x => x != null);
                    if (jingdu != null)
                    {
                        string str = jingdu.Description;
                        MatchCollection matchCollection = Regex.Matches(str, "\\d+");
                        dr[ColNameOfLatitude] = int.Parse(matchCollection[0].Value) + int.Parse(matchCollection[1].Value) / 60.0 + int.Parse(matchCollection[1].Value) / 60.0 / 60.0;
                    }

                    var weidu = directories.Where(s => s.Name != "File").Select(k => k.Tags.FirstOrDefault(t => t.Name == "GPS Longitude")).FirstOrDefault(x => x != null);
                    if (weidu != null)
                    {
                        string str = weidu.Description;
                        MatchCollection matchCollection = Regex.Matches(str, "\\d+");
                        dr[ColNameOfLongitude] = int.Parse(matchCollection[0].Value) + int.Parse(matchCollection[1].Value) / 60.0 + int.Parse(matchCollection[1].Value) / 60.0 / 60.0;

                    }

                    var haiba = directories.Where(s => s.Name != "File").Select(k => k.Tags.FirstOrDefault(t => t.Name == "GPS Altitude")).FirstOrDefault(x => x != null);
                    if (haiba != null)
                    {
                        string str = haiba.Description;
                        dr[ColNameOfAltitude] = Regex.Match(str, "\\d+").Value;
                    }

Simple for everyone to look to read Exif information.
The existence of these valuable information inside the tag

Jpeg aspects of information

photoshop processed information is stored inside, so do not want to sue Adobe then, the last step is best to delete the Exif, ha ha.

photoshop processed information are stored including

Photographer desired also on the inside

Technical exchange QQ group

QQ group name: Excel catalyst open discussion groups, QQ group number: 788 145 319
Excel catalyst dimensional code open source discussion groups

About Excel catalyst

Excel catalyst name, first a public micro-channel number, then shun its name, officially launched the Excel plug-in, plug-continuous updates, the update cycle depends on my time may be able to fight for one week on a line function modules. Excel catalyst plug-permanent commitment to individual users free of charge!

Excel catalyst plugin uses the latest deployment of technology, once installed, all future updates automatically update is complete, no need to repeat concerns updates, manually download the installation package to reinstall, you can always keep the latest version with a single installation!

Excel催化剂插件下载链接:https://pan.baidu.com/s/1Iz2_NZJ8v7C9eqhNjdnP3Q

Contact the author

No public

取名催化剂,因Excel本身的强大,并非所有人能够立马享受到,大部分人还是在被Excel软件所虐的阶段,就是头脑里很清晰想达到的效果,而且高手们也已经实现出来,就是自己怎么弄都弄不出来,或者更糟的是还不知道Excel能够做什么而停留在不断地重复、机械、手工地在做着数据,耗费着无数的青春年华岁月。所以催生了是否可以作为一种媒介,让广大的Excel用户们可以瞬间点燃Excel的爆点,无需苦苦地挣扎地没日没夜的技巧学习、高级复杂函数的烧脑,最终走向了从入门到放弃的道路。

最后Excel功能强大,其实还需树立一个观点,不是所有事情都要交给Excel去完成,也不是所有事情Excel都是十分胜任的,外面的世界仍然是一个广阔的世界,Excel只是其中一枚耀眼的明星,还有其他更多同样精彩强大的技术、工具等。*Excel催化剂也将借力这些其他技术,让Excel能够发挥更强大的爆发!

关于Excel催化剂作者

姓名:李伟坚,从事数据分析工作多年(BI方向),一名同样在路上的学习者。
服务过行业:零售特别是鞋服类的零售行业,电商(淘宝、天猫、京东、唯品会)

技术路线从一名普通用户,通过Excel软件的学习,从此走向数据世界,非科班IT专业人士。
历经重重难关,终于在数据的道路上达到技术平原期,学习众多的知识不再太吃力,同时也形成了自己的一套数据解决方案(数据采集、数据加工清洗、数据多维建模、数据报表展示等)。

Specializes in technology areas: Excel and other Office family of software, the secondary development of VBA & VSTO, Sqlserver database technology, business intelligence BI technology Sqlserver of, Powerbi technology, cloud server deployment technologies.

2018 began his career made a major adjustment, from the original full-time job, turned freelance, no fixed income, temporarily on the road ahead is not clear, bitter return to full-time job, for Excel catalyst operations and development must be greatly affected (within the time could not maintain full-time job can not just put the results in a work published in time, the time outside of work is very limited, because he has thirty years of age, family responsibility).

And the majority of advocates with expectations: Excel catalyst has been able to run down, I have the benefit of the group were able to support ( multi-message encouragement, friend circle under forwarded the recommendation under small a reward and the most focused and where the company can and recommended recommended peers, so I can maximize the value of technology in your company to achieve a win-win (you can imagine how the data is preliminary consultant or small projects to develop forms of cooperation).

Guess you like

Origin www.cnblogs.com/ExcelCuiHuaJi/p/11225030.html