Skip to content

Reading tiff files using libtiff, compiled to webassembly

Notifications You must be signed in to change notification settings

aviklai/libtiffjs

Repository files navigation

Build Status Coverage Status npm version

libtiffjs

Reading tiff using libtiff, compiled to webassembly.
Inspired by loam (Worker and wasm communication architecture) - https://github.com/azavea/loam
Using libtiff wasm - https://github.com/Twinklebear/tiff.js

Installation instructions - webpack

  1. Run npm install --save libtiffjs
  2. Install file-loader: npm install --save-dev file-loader
  3. Add the following alias to webpack config file: libtiffjs: path.join(__dirname, 'node_modules', 'libtiffjs', 'lib')
  4. Load libtiffjs files using file-loader (add to webpack config):
{ 
   test: /(libtiff-worker\.js|tiff\.raw\.wasm|tiff\.raw\.js)$/,
   type: 'javascript/auto',
   loader: 'file-loader?name=[name].[ext]',
}
  1. To load the library in your code:
import * as libtiffjs from 'libtiffjs';
require('libtiffjs/libtiff-worker.js'); 
require('libtiffjs/tiff.raw.js');
require('libtiffjs/tiff.raw.wasm');
libtiffjs.initialize();

Demo

https://libtiffjs.netlify.app

The demo code is available here:
https://github.com/aviklai/libtiffjs-example