传送门,https://github.com/seikichi/tiff.js
代码:
Browser
Download tiff.min.js and load the script by yourself:
var xhr = new XMLHttpRequest();
xhr.responseType = 'arraybuffer';
xhr.open('GET', "url/of/a/tiff/image/file.tiff");
xhr.onload = function (e) {
var tiff = new Tiff({buffer: xhr.response});
var canvas = tiff.toCanvas();
document.body.append(canvas);
};
xhr.send();
默认10M大小,如果想突破限制,
实例化Tiff对象前,加入
Tiff.initialize({ TOTAL_MEMORY :50*1024*1024 });//支持最大50M