从int8Array获取EXIF

6

1
请返回翻译后的文本。 - Bergi
我想编写尽可能简化的自定义函数。 - Jacob
那个脚本不是很简单吗? - Bergi
我认为它不能与我的int8Array类型一起使用。我很难理解它! - Jacob
你能帮忙吗?请。 - Jacob
不幸的是,EXIF并不特别简单;存在不同的规范、字节顺序、用于IPTC或GPS的IFD部分,此外相机制造商有时会完全忽略规范。因此,“简单”的解决方案不太可能。您可以分享一下您尝试过的方法吗? - Graham
1个回答

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>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接