# browser-tiff.js

> browser-tiff.js is a conversion of tiff.js, that nullified the require('crypto'), require('fs') inside the script when importing to web projects

Latest version **1.0.1** (published 2019-01-30) · SEE LICENSE IN LICENSE license · 0 weekly downloads

## Install

```sh
npm install browser-tiff.js
pnpm add browser-tiff.js
yarn add browser-tiff.js
bun add browser-tiff.js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-01-30 |
| First published | 2019-01-29 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | tonycwu |
| Maintainers | tonycwu |
| Keywords | conversion, image, tiff, browser-tiff |

## Links

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

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-01-30
- 1.0.0 — 2019-01-29

## README

# browser-tiff.js

browser-tiff.js is a direct clone of tiff.js, but with require() methods removed, so it can work without errors during 'import' and compilation for web projects.

Below are the only changes to tiff.min.js, basically Function.prototype() act like noop()

From:

```js
... = require(...)

```
To:

```js
... = Function.prototype(...)

```

## Example Usage in Angular

1. Copy browser-tiff.d.ts to your project root folder (This is for Typescript type definition)
2. In your Angular component, use import like this:
```js
import * as Tiff from 'browser-tiff.js';
```   
3. Use normally as describe in original tiff.js usage below.


# Original tiff.js Readme below


# tiff.js

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

## [Demo](http://seikichi.github.io/tiff.js/)

- [view TIFF files](http://seikichi.github.io/tiff.js/basic.html)
- [view a TIFF file using a web worker](http://seikichi.github.io/tiff.js/worker.html)
- [view a multipage TIFF file](http://seikichi.github.io/tiff.js/multipage.html)
- [view your TIFF file](http://seikichi.github.io/tiff.js/upload.html)

## Usage

### Browser

Download tiff.min.js and load the script by yourself:

```js
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

```sh
$ npm install tiff.js
```

Example

```js
// 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~~
  - Fixed by [Tetedeiench](https://github.com/seikichi/tiff.js/issues/15#issuecomment-257103842)
- 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

- [photopea/UTIF.js](https://github.com/photopea/UTIF.js)
- [image-js/tiff](https://github.com/image-js/tiff)

## License

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

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