`

exif.js获取照片扩展信息

 
阅读更多

 

以下为引用代码:

<!doctype html>

  <html>
  <head>
  <script type="text/javascript" src="../exif.js"></script>
   
  </head>
  <body>
  Upload a local file to read Exif data.
  <br/>
  <input id="file-input" type="file" />
  <br/><br/>
   
  Click the images to read Exif data. The first image tests reading single tags, while the other two simply show all available data.
  <br/><br/>
  Note: these examples will not work if running from a local file:// URL.
  <br/><br/>
  <img src="DSCN0614_small.jpg" id="img1" />
  <br/>
  <img src="Bush-dog.jpg" id="img2" />
  <br/>
  <img src="dsc_09827.jpg" id="img3" /><br/>
  <br/>
  <button id="objecturltest">Object URL Test</button><br/>
  <br/>
  <button id="blobtest">Blob Test</button><br/>
  <br/>
  <button id="base64test">Base64 Test</button><br/>
   
   
  <script>
  document.getElementById("img1").onclick = function() {
  EXIF.getData(this, function() {
  var make = EXIF.getTag(this, "Make"),
  model = EXIF.getTag(this, "Model");
  alert("I was taken by a " + make + " " + model);
  });
  }
   
  document.getElementById("img2").onclick = function() {
  EXIF.getData(this, function() {
  alert(EXIF.pretty(this));
  });
  }
   
  document.getElementById("img3").onclick = function() {
  EXIF.getData(this, function() {
  alert(EXIF.pretty(this));
  });
  }
   
  document.getElementById("file-input").onchange = function(e) {
  EXIF.getData(e.target.files[0], function() {
  alert(EXIF.pretty(this));
  });
  }
   
  document.getElementById("base64test").onclick = function() {
  var image = new Image();
  image.onload = function() {
  EXIF.getData(image, function() {
  alert(EXIF.pretty(this));
  });
  };
  image.src = "data:image/jpeg;base64,/9j/4QaZRXhpZgAASUkqAAgAAAAQAAABAwABAAAAkAEAAAEBAwABAAAALAEAAAIBAwADAAAAzgAAAAYBAwABAAAAAgAAAA4BAgALAAAA1AAAAA8BAgAGAAAA3wAAABABAgAGAAAA5QAAABIBAwABAAAAAQAAABUBAwABAAAAAwAAABoBBQABAAAA6wAAABsBBQABAAAA8wAAACgBAwABAAAAAgAAADEBAgAdAAAA+wAAADIBAgAUAAAAGAEAABMCAwABAAAAAgAAAGmHBAABAA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AAAAAAAAAP4AAADhCSU0EDQAAAAAABAAAAB44QklNBBkAAAAAAAQAAAAeOEJJTQPzAAAAAAAJAAAAAAAAAAABADhCSU0ECgAAAAAAAQAAOEJJTScQAAAAAAAKAAEAAAAAAAAAAjhCSU0D9QAAAAAASAAvZmYAAQBsZmYABgAAAAAAAQAvZmYAAQChmZoABgAAAAAAAQAyAAAAAQBaAAAABgAAAAAAAQA1AAAAAQAtAAAABgAAAAAAAThCSU0D+AAAAAAAcAAA/////////////////////////////wPoAAAAAP////////////////////////////8D6AAAAAD/////////////////////////////A+gAAAAA/////////////////////////////wPoAAA4QklNBAgAAAAAABAAAAABAAACQAAAAkAAAAAAOEJJTQQeAAAAAAAEAAAAADhCSU0EGgAAAAADUQAAAAYAAAAAAAAAAAAAABAAAAAQAAAADgBEAFMAQwBOADAANgAxADQAXwBzAG0AYQBsAGwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAEAAAAAAABudWxsAAAAAgAAAAZib3VuZHNPYmpjAAAAAQAAAAAAAFJjdDEAAAAEAAAAAFRvcCBsb25nAAAAAAAAAABMZWZ0bG9uZwAAAAAAAAAAQnRvbWxvbmcAAAAQAAAAAFJnaHRsb25nAAAAEAAAAAZzbGljZXNWbExzAAAAAU9iamMAAAABAAAAAAAFc2xpY2UAAAASAAAAB3NsaWNlSURsb25nAAAAAAAAAAdncm91cElEbG9uZwAAAAAAAAAGb3JpZ2luZW51bQAAAAxFU2xpY2VPcmlnaW4AAAANYXV0b0dlbmVyYXRlZAAAAABUeXBlZW51bQAAAApFU2xpY2VUeXBlAAAAAEltZyAAAAAGYm91bmRzT2JqYwAAAAEAAAAAAABSY3QxAAAABAAAAABUb3AgbG9uZwAAAAAAAAAATGVmdGxvbmcAAAAAAAAAAEJ0b21sb25nAAAAEAAAAABSZ2h0bG9uZwAAABAAAAADdXJsVEV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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw/eHBhY2tldCBlbmQ9InciPz7/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAA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AgMAESExgRIiEwRBEQEBAQAAAAAAAAAAAAAAAAABAAL/2gAMAwEAAhEDEQA/ALXrg7BGquz/AFTheo7amYs8cUeDLYZ6DWsi2m//0NGcxRqXuL25SGiJZJ6/ZG+zY1+07VIBPHJzShGt/9k="
  }
   
   
  document.getElementById("objecturltest").onclick = function() {
  var http = new XMLHttpRequest();
  http.open("GET", "DSCN0614_small.jpg", true);
  http.responseType = "blob";
  http.onload = function(e) {
  if (this.status === 200) {
  var image = new Image();
  image.onload = function() {
  EXIF.getData(image, function() {
  alert(EXIF.pretty(this));
  });
  };
  image.src = URL.createObjectURL(http.response);
   
  }
  };
  http.send();
  }
   
   
  document.getElementById("blobtest").onclick = function() {
  var http = new XMLHttpRequest();
  http.open("GET", "DSCN0614_small.jpg", true);
  http.responseType = "blob";
  http.onload = function(e) {
  if (this.status === 200) {
  EXIF.getData(http.response, function() {
  alert(EXIF.pretty(this));
  });
  }
  };
  http.send();
  }
  </script>
   
   
   
  </body>
  </html>

用到的js: 1. megapix-image.js, https://github.com/stomita/ios-imagefile-megapixel 2. exif.js, https://github.com/jseidelin/exif-js 3. binaryajax.js, https://github.com/jseidelin/binaryajax/ 首先自己input file选择的图片readAsDataURL获取到base64的字符串, 再用 binaryajax获取图片的二进制数据(data-url to a binary string). 然后根据二进制数据利用exif.js获取exif信息(主要是exif.Orientation), 再用去重新画图, 再读取新的base64图片

 

 

1 iOS6bug, 较大的图片可能会发生(大概>2M), 已经有人提交bug Apple(iOS7未测试). 2 是因为相机拍摄的图片本身可能就是反转的, 拍摄的图片里EXIF信息的 orientation记录了图片的转向(取值范围是1/3/6/8, 一般是:1/3/6/8). 默认竖拍的时候其实就是翻转的, 这时的orientation=6(相当于向左转90, -90deg) .....

 

http://blog.csdn.net/yaoyuan_difang/article/details/38656461

分享到:
评论

相关推荐

    exif.js Exif.js 提供了 JavaScript 读取图像的原始数据的功能扩展

    Exif.js 提供了 JavaScript 读取图像的原始数据的功能扩展,例如:拍照方向、相机设备型号、拍摄时间、ISO 感光度、GPS 地理位置等数据。 注意事项: EXIF 数据主要来自拍摄的照片,多用于移动端开发,PC 端也会...

    jquery.exif_javascript_exif_jquery_源码.zip

    这些信息对于照片编辑和管理非常重要,而jQuery.exif.js就是用来读取和利用这些数据的JavaScript库。 jQuery.exif.js的核心功能是通过解析JPEG文件的二进制数据,提取其中的Exif信息。它依赖于JavaScript的Blob对象...

    Exifjs用于读取EXIF图像元数据的JavaScript库

    EXIF是一种扩展的TIFF格式,通常用于数码相机拍摄的照片,包含了丰富的信息,如拍摄日期、时间、地理位置、相机型号、曝光设置等。JavaScript库如Exifjs使得在网页端处理这些元数据变得可能,这对于图片展示、图片...

    ios拍照上传图片倒立js

    JavaScript(JS)作为Web开发中的主要脚本语言,通常用于处理用户上传的图片,这时就需要对Exif信息进行处理来修正图片的朝向。 Exif是一种扩展的JPEG格式,用于存储图像文件的附加信息,如相机型号、拍摄时间、...

    EXIF-Viewer_v2.4.2.rar

    《EXIF-Viewer_v2.4.2:深入解析图片EXIF信息与XSS漏洞复现》 在当今数字化时代,图片已经成为了我们日常生活和工作中不可或缺的一部分。然而,每张图片背后都隐藏着一些元数据,这些元数据包含了拍摄设备、时间、...

    客户端上传图片的同时读取图片的经纬度

    应用场景:用手机拍摄图片,然后上传到服务器,同时自动获取到该图片的经纬度信息,保存到数据库。...该文件压缩包已含有exif.min.js库文件和示例文档,可根据各自的具体业务需求进行扩展完善。浏览器要求:支持html5。

    jquery 读取图片信息

    jQuery-exif是一个轻量级的JavaScript库,它扩展了jQuery的功能,提供了对图片EXIF数据的解析。该插件的工作原理是利用HTML5的File API来读取图片文件,然后解析其中的二进制数据,提取出EXIF信息。由于浏览器的安全...

    EXIF查看器「EXIF Viewer」-crx插件

    顶级功能:-完全免费-只需单击鼠标右键即可获得各种信息-预览图像详细信息-支持300多个摄像头-直方图或RGB颜色重构-将exif信息自动复制到剪贴板-共享重要更新的通知-其他功能即将推出…-99%的网站不受影响。...

    PHP 苹果手机上传图片出现旋转解决代码.

    JavaScript库如`Exif.js`可以帮助获取和处理Exif信息,但这可能会增加前端的复杂性。 总的来说,解决苹果手机上传图片旋转问题的关键在于正确处理Exif信息中的方向标志。无论是使用PHP的Imagick、GD库,还是前端的...

    exifdetector:在线检测带有地理标记的图像

    这是一个 chrome 扩展,用于自动扫描访问网页上的 img 标签以获取 EXIF 数据,并将 DMS 纬度/经度转换为十进制以与谷歌地图一起使用。 动机 该项目旨在在线显示 GPS 标记照片的流行(或缺乏) 安装 克隆 repo,打开 ...

    photosint:PhotOSINT 是用于图像和照片的 OSINT chrome 扩展。 它会在用户浏览时扫描每个网页上的带有 EXIF 数据的图像,并为不同搜索引擎(Google、Yandex、Bing、Tineye)中的反向图像搜索提供上下文选项

    Chrome 扩展程序可在浏览网页时检查网页中的所有图像,以获取 EXIF 数据,并在弹出窗口中显示找到的图像及其 EXIF。 还提供了在不同搜索引擎中进行反向图像搜索的上下文选项。 只需单击一下,您就可以反向图像搜索...

    EXIF QuickView-crx插件

    添加“在顶部显示图像”选项-删除外部和CDN依赖项-删除jQuery并使用纯javascript以获得更好的性能-仅出于改进目的1.9仅出于设置目的而添加分析功能-由于任何隐私问题,因此不会从此扩展程序1.8中收集数据-修复覆盖...

    EXIF快速查看「EXIF Quick View」-crx插件

    添加“在顶部显示图像”选项-删除外部和CDN依赖项-删除jQuery并使用纯javascript以获得更好的性能-仅出于改进目的1.9仅出于设置目的而添加分析功能-由于任何隐私问题,因此不会从此扩展程序1.8中收集数据-修复覆盖...

    flickrjs:一个简单的 Flickr API 的 JavaScript 包装器

    3. **照片操作**:获取照片详细信息、下载照片、获取照片的元数据(如EXIF信息)等。 4. **相册管理**:创建、更新、删除相册,以及获取相册中的照片列表。 5. **授权机制**:使用 OAuth 进行身份验证,确保安全地...

    Chrome插件反查微博图片po主

    【Chrome插件反查微博图片po主】是一个利用JavaScript技术实现的浏览器扩展程序,专为Chrome浏览器设计。这个插件的主要功能是帮助用户快速找出在微博上分享的图片的原始发布者,即“po主”。在微博这样的社交媒体...

    viewerImage:TagSpaces图片查看器扩展

    对于JPG文件,它具有集成的Exif和IPTC读取器,可根据Exif信息自动旋转照片 支持图像打印 灰度滤镜 二手图书馆 值得庆幸的是,此扩展继承了以下出色的库: 安装 此扩展与TagSpaces的任何新版本打包在一起 源代码 该...

    Exponator Live!-crx插件

    ,用户可以在查看图片的同时获取这些详细的技术信息,这对于摄影爱好者和专业人士来说非常实用,可以帮助他们更好地理解和分析照片的拍摄条件。 这款插件由3fonov开发,尽管是旧项目的更新版本,但它已经适应了新...

    商业源码-编程源码-Menalto Gallery v3.0 RC1.zip

    4. **元数据管理**:支持EXIF和IPTC元数据,可以自动获取并显示相机型号、拍摄日期等信息,方便管理大量照片。 5. **搜索与筛选功能**:用户可以通过关键词、日期或其他条件快速查找图片。 6. **评论和社交分享**...

Global site tag (gtag.js) - Google Analytics