# tiff

> TIFF image decoder written entirely in JavaScript

Latest version **7.1.3** (published 2025-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install tiff
pnpm add tiff
yarn add tiff
bun add tiff
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 7.1.3 |
| Published | 2025-12-18 |
| First published | 2015-09-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 2 |
| Unpacked size | 133.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 221 |
| Author | Michaël Zasso |
| Maintainers | lpatiny, stropitek, targos, cheminfo-bot |

## Links

- npm: https://www.npmjs.com/package/tiff
- Repository: https://github.com/image-js/tiff
- Homepage: https://image-js.github.io/tiff/
- Issues: https://github.com/image-js/tiff/issues
- npm.io page: https://npm.io/package/tiff

## Dependencies (2)

- [fflate](https://npm.io/package/fflate.md) ^0.8.2
- [iobuffer](https://npm.io/package/iobuffer.md) ^6.0.0

## Recent versions

- 7.1.3 (latest) — 2025-12-18
- 7.1.2 — 2025-10-07
- 7.1.1 — 2025-08-13
- 7.1.0 — 2025-07-23
- 7.0.0 — 2025-06-15
- 6.2.0 — 2025-03-06
- 6.1.1 — 2024-09-12
- 6.1.0 — 2024-05-21
- 6.0.0 — 2024-04-08
- 5.0.3 — 2021-11-05
- 5.0.2 — 2021-10-31
- 5.0.1 — 2021-10-12
- 5.0.0 — 2021-07-06
- 4.3.0 — 2020-12-03
- 4.2.0 — 2020-08-21
- … 15 more at https://npm.io/package/tiff/versions

## README

<h3 align="center">
  <a href="https://www.zakodium.com">
    <img src="https://www.zakodium.com/brand/zakodium-logo-white.svg" width="50" alt="Zakodium logo" />
  </a>
  <p>
    Maintained by <a href="https://www.zakodium.com">Zakodium</a>
  </p>
</h3>

# tiff

[![NPM version](https://img.shields.io/npm/v/tiff.svg)](https://www.npmjs.com/package/tiff)
[![npm download](https://img.shields.io/npm/dm/tiff.svg)](https://www.npmjs.com/package/tiff)
[![test coverage](https://img.shields.io/codecov/c/github/image-js/tiff.svg)](https://codecov.io/gh/image-js/tiff)
[![license](https://img.shields.io/npm/l/tiff.svg)](https://github.com/image-js/tiff/blob/main/LICENSE)

TIFF image decoder written entirely in JavaScript.

## Installation

```console
npm install tiff
```

## Compatibility

### [TIFF standard](./TIFF6.pdf)

The library can currently decode greyscale and RGB images (8, 16 or 32 bits).
It supports LZW compression and images with an additional alpha channel.

### Extensions

Images compressed with Zlib/deflate algorithm are also supported.

## API

### [Complete API documentation](https://image-js.github.io/tiff/)

### `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
- `alpha` - `true` if the image has an additional alpha channel
- `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](./LICENSE)

---
_Source: https://npm.io/package/tiff · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
