从int8array获取具有我的图像数据的EXIF信息的最佳方法是什么。 我知道问题太简单了,但我真的被卡住了
我在考虑使用这个库:https://github.com/vjeux/jDataView 或者修改此库:http://blog.nihilogic.dk/2008/05/reading-exif-data-with-javascript.html
答案 0 :(得分:1)
您必须对此脚本进行少量修改,因为它会创建自己的字节数组,但这完全符合您的要求:
https://github.com/jseidelin/exif-js
<html>
<head>
<script type="text/javascript" src="../binaryajax.js"></script>
<script type="text/javascript" src="../exif.js"></script>
</head>
<body>
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/>
<img src="DSCN0614_small.jpg" id="img1" />
<br/>
<img src="Bush-dog.jpg" id="img2" />
<br/>
<img src="dsc_09827.jpg" id="img3" /><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));
});
}
</script>
</body>
</html>