tiff.js is a port of the LibTIFF by compiling the LibTIFF C code with Emscripten.
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();
$ npm install tiff.js
Example
// Usage: node this-file.js input.tiff
var Tiff = require('tiff.js');
var fs = require('fs');
var filename = process.argv[2];
var input = fs.readFileSync(filename);
var image = new Tiff({ buffer: input });
console.log(filename + ': width = ' + image.width() + ', height = ' + image.height());
see tiff.d.ts
The LibTIFF is LibTIFF Software License, zlib and additional code are zlib License.