Gathering detailed insights and metrics for utif
Gathering detailed insights and metrics for utif
Gathering detailed insights and metrics for utif
Gathering detailed insights and metrics for utif
npm install utif
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
451 Stars
144 Commits
92 Forks
13 Watchers
2 Branches
6 Contributors
Updated on Jul 15, 2025
Latest Version
3.1.0
Package Id
utif@3.1.0
Size
21.79 kB
NPM Version
6.4.0
Node Version
10.9.0
Published on
Jun 18, 2019
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
A small, fast and advanced TIFF / EXIF (+ DNG, CR2, NEF and other TIFF-ish files) decoder and encoder. It is the main TIFF library for Photopea image editor. Try to open your TIFF file with Photopea to see, if UTIF.js can parse it.
For RAW files, UTIF.js only decodes raw sensor data (and JPG previews, if there are any). It does not convert the raw data into a displayable image (RGBA). Such conversion is complex and out of scope of this library.
Download and include the UTIF.js
file in your code. If you're in NodeJS or otherwise using NPM, run:
1npm install utif
UTIF.decode(buffer)
buffer
: ArrayBuffer containing TIFF or EXIF dataUTIF.decodeImage(buffer, ifd)
buffer
: ArrayBuffer containing TIFF or EXIF dataifd
: the element of the output of UTIF.decode()width
: the width of the imageheight
: the height of the imagedata
: decompressed pixel data of the imageTIFF files may have various number of channels and various color depth. The interpretation of data
depends on many tags (see the TIFF 6 specification). The following function converts any TIFF image into a 8-bit RGBA image.
UTIF.toRGBA8(ifd)
ifd
: image file directory (element of "ifds" returned by UTIF.decode(), processed by UTIF.decodeImage())1function imgLoaded(e) { 2 var ifds = UTIF.decode(e.target.response); 3 UTIF.decodeImage(e.target.response, ifds[0]) 4 var rgba = UTIF.toRGBA8(ifds[0]); // Uint8Array with RGBA pixels 5 console.log(ifds[0].width, ifds[0].height, ifds[0]); 6} 7 8var xhr = new XMLHttpRequest(); 9xhr.open("GET", "my_image.tif"); 10xhr.responseType = "arraybuffer"; 11xhr.onload = imgLoaded; xhr.send();
If you are not a programmer, you can use TIFF images directly inside the <img>
element of HTML. Then, it is enough to call UTIF.replaceIMG()
once at some point.
UTIF.replaceIMG()
1<body onload="UTIF.replaceIMG()"> 2... 3<img src="image.tif" /> <img src="dog.tif" /> ...
And UTIF.js will do the rest. Internally, the "src" attribute of the image will be replaced with a new URI of the image (base64-encoded PNG). Note, that you can also insert DNG, CR2, NEF and other raw images into HTML this way.
You should not save images into TIFF format in the 21st century. Save them as PNG instead (e.g. using UPNG.js). If you still want to use TIFF format for some reason, here it is.
UTIF.encodeImage(rgba, w, h, metadata)
rgba
: ArrayBuffer containing RGBA pixel dataw
: image widthh
: image heightmetadata
[optional]: IFD object (see below)UTIF.encode(ifds)
ifds
: array of IFDs (image file directories). An IFD is a JS object with properties "tXYZ" (where XYZ are TIFF tags)TIFF format sometimes uses Inflate algorithm for compression (but it is quite rare). Right now, UTIF.js calls Pako.js for the Inflate method.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
2 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 3
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More