在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):exif-js/exif-js开源软件地址(OpenSource Url):https://github.com/exif-js/exif-js开源编程语言(OpenSource Language):JavaScript 64.9%开源软件介绍(OpenSource Introduction):Exif.jsA JavaScript library for reading EXIF meta data from image files. You can use it on images in the browser, either from an image or a file input element. Both EXIF and IPTC metadata are retrieved. This package can also be used in AMD or CommonJS environments. Note: The EXIF standard applies only to InstallInstall
Or Bower:
Then add a <script src="vendors/exif-js/exif-js"></script> You can also use a minified version hosted on jsDelivr <script src="https://cdn.jsdelivr.net/npm/exif-js"></script> UsageThe package adds a global Start with calling the
As a second parameter you specify a callback function. In the callback function you should use You can get all tages with Important: Note that you have to wait for the image to be completely loaded, before calling JavaScript: window.onload=getExif;
function getExif() {
var img1 = document.getElementById("img1");
EXIF.getData(img1, function() {
var make = EXIF.getTag(this, "Make");
var model = EXIF.getTag(this, "Model");
var makeAndModel = document.getElementById("makeAndModel");
makeAndModel.innerHTML = `${make} ${model}`;
});
var img2 = document.getElementById("img2");
EXIF.getData(img2, function() {
var allMetaData = EXIF.getAllTags(this);
var allMetaDataSpan = document.getElementById("allMetaDataSpan");
allMetaDataSpan.innerHTML = JSON.stringify(allMetaData, null, "\t");
});
} HTML: <img src="image1.jpg" id="img1" />
<pre>Make and model: <span id="makeAndModel"></span></pre>
<br/>
<img src="image2.jpg" id="img2" />
<pre id="allMetaDataSpan"></pre>
<br/> Note there are also alternate tags, such the XMP
Since issue #53 was merged also extracting of XMP data is supported. To not slow down this is optional, and you need to call Please refer to the source code for more advanced usages such as getting image data from a File/Blob object ( ContributionsThis is an open source project. Please contribute by forking this repo and issueing a pull request. The project has had notable contributions already, like reading ITPC data. You can also contribute by filing bugs or new features please issue. Or improve the documentation. Please update this README when you do a pull request of proposed changes in base functionality. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论