我正试图从这样的exif数据中获取方向:Extract exif orientation
var img = new Image();
img.src = "data:image/jpeg;base64," + imgData;
img.onload = function () {
var canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
var bin = atob(img.src.split(',')[1]);
var exif = EXIF.readFromBinaryFile(new BinaryFile(bin));
alert(exif.Orientation);
alert(EXIF.getTag(imgData, "Orientation"));
然而它的所有警报都是未定义的......我不确定原因。
我在我的html文件中包含了exif.js和binaryajax.js,所以这不是问题