• Stars
    star
    378
  • Rank 112,621 (Top 3 %)
  • Language
    TypeScript
  • License
    Other
  • Created almost 11 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

tiff.js is a port of LibTIFF by compiling the LibTIFF C code with Emscripten.

tiff.js

tiff.js is a port of the LibTIFF by compiling the LibTIFF C code with Emscripten.

Demo

Usage

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();

Node.js

$ 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());

API

see tiff.d.ts

Note

  • This library does not support JPEG-based compressed TIFF files
  • When you load large tiff file, you will see the error message "Cannot enlarge memory arrays in asm.js"
    • in such case, please call 'Tiff.initialize({TOTAL_MEMORY: ... })' before you create a Tiff instance
  • This JavaScript library uses only some parts of the LibTIFF features
    • To be more precise, I use following functions only
    • TIFFOpen, TIFFClose, TIFFGetField, TIFFReadRGBAImage, TIFFSetDirectory, TIFFCurrentDirectory, TIFFReadDirectory

Alternatives

License

The LibTIFF is LibTIFF Software License, zlib and additional code are zlib License.

More Repositories

1

restructured

Pure JavaScript reStructuredText parser
JavaScript
58
star
2

pry-inline

Inline variables view like RubyMine in Pry
Ruby
57
star
3

comicbed

A browser based comic book reader
TypeScript
32
star
4

unrar.js

unrar.js is a port of GNA UnRAR by compiling the C code with Emscripten.
JavaScript
9
star
5

tuitwi

TUI twitter client
Python
9
star
6

textlint-plugin-asciidoctor

Yet another Asciidoctor support for textlint.
JavaScript
9
star
7

shoshi

国立国会図書館,Amazon,楽天,Wikipedia のAPIを組み合わせて書籍のメタデータを取得するプログラム/ライブラリ
Python
9
star
8

stb_image.js

a pure Javascript image decoder
TypeScript
7
star
9

htmldiff

Rust port of https://github.com/myobie/htmldiff (but using more efficient diff algorithm)
Rust
6
star
10

kytea-python

Python
5
star
11

pumblr

A python library for the Tumblr API.
Python
4
star
12

icfpc2015

Slack は KMC の #icfpc2015kanto で
C++
3
star
13

asciidoctor-i18n

https://github.com/asciidoctor/asciidoctor/wiki/Design-Doc:-i18n
Ruby
3
star
14

greentty

A hobby terminal emulator for Windows (Rust, ConPTY)
Rust
3
star
15

kojouml

TypeScript
2
star
16

pronto-checkstyle

Pronto runner for Checkstyle
Ruby
2
star
17

pdf-image-extractor.js

JavaScript
2
star
18

pyw3mimg

A python wrapper for the w3mimgdisplay
Python
2
star
19

pronto-textlint

Pronto runner for textlint
Ruby
2
star
20

gopl

読書会のような何かをしてる本
Go
2
star
21

ircmost

1
star
22

tapl-rust

Rust
1
star
23

icfpc2017

Tean Name: ゲームセンター YAGI
C++
1
star
24

nozokimi

A toy HTTPS proxy using Rust and tokio
Rust
1
star
25

similot

A twitter bot which retweets the similar posts with you
Python
1
star
26

icfpc2020

Rust
1
star
27

pronto-checkstyle-findbugs-example

An example project for seikichi/pronto-checkstyle and seikichi/pronto-findbugs plugins
Ruby
1
star
28

exercism

会社でやってる読書会の演習問題
Rust
1
star
29

prettier-plugin-groovy

ANTLR
1
star
30

llama-aws-lambda-slack-chatbot

Python
1
star
31

kmc-spring-camp-time-table

整数計画ソルバが最高のKMC春合宿時間割を作るよ
Python
1
star
32

software-design-for-flexibility

https://mitpress.mit.edu/books/software-design-flexibility
Scheme
1
star
33

sandbox

砂場
JavaScript
1
star
34

textlint-plugin-rst-style

JavaScript
1
star
35

tampopo

Go
1
star
36

fmwasm

Rust
1
star
37

hackvm2wasm

Hack VM (https://www.nand2tetris.org/) to WASM
TypeScript
1
star