Skip to content
TIFF image decoder written entirely in JavaScript
JavaScript
Branch: master
Clone or download
Latest commit 138cb0e Sep 12, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__ fix: support WhiteIsZero Sep 12, 2018
src fix: support WhiteIsZero Sep 12, 2018
.babelrc refactor: move to ES6 modules Jul 17, 2017
.eslintrc.yml chore: update dependencies Sep 12, 2018
.gitignore refactor: move to ES6 modules Jul 17, 2017
.travis.yml chore: update dependencies Sep 12, 2018
History.md 3.0.1 Sep 12, 2018
LICENSE Initial commit Sep 19, 2015
README.md fix: support WhiteIsZero Sep 12, 2018
TIFF6.pdf add spec PDF to the repo Jul 17, 2017
package-lock.json 3.0.1 Sep 12, 2018
package.json 3.0.1 Sep 12, 2018
rollup.config.js chore: update dependencies Sep 12, 2018

README.md

tiff

NPM version build status npm download

TIFF image decoder written entirely in JavaScript.

Installation

npm install tiff

Compatibility

Platform

This package is written using ES2015 features. It is natively compatible with recent web browsers and Node.js. You can transpile it with a tool like babel if you need to support more JavaScript engines.

TIFF standard

The library can currently decode greyscale and RGB images (8, 16 or 32 bits). It does not support any compression algorithm yet.

API

tiff.decode(data[, options])

Decodes the file and returns TIFF IFDs.

IFD object

Each decoded image is stored in an IFD.

IFD#data

The data property is a Typed Array containing the pixel data. It is a Uint8Array for 8bit images, a Uint16Array for 16bit images and a Float32Array for 32bit images.

Other properties of IFD
  • size - number of pixels
  • width - number of columns
  • height - number of rows
  • bitsPerSample - bit depth
  • xResolution
  • yResolution
  • resolutionUnit

tiff.pageCount(data)

Returns the number of IFDs (pages) in the file.

tiff.isMultiPage(data)

Returns true if the file has 2 or more IFDs (pages) and false if it has 1. This is slightly more efficient than calling pageCount() if all you need to know is whether the file has multiple pages or not.

License

MIT

You can’t perform that action at this time.