Gathering detailed insights and metrics for utif2
Gathering detailed insights and metrics for utif2
npm install utif2
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
29,592,177
Last Day
98,204
Last Week
455,351
Last Month
2,042,764
Last Year
20,343,807
427 Stars
141 Commits
86 Forks
14 Watching
2 Branches
6 Contributors
Minified
Minified + Gzipped
Latest Version
4.1.0
Package Id
utif2@4.1.0
Unpacked Size
102.30 kB
Size
33.80 kB
File Count
5
NPM Version
8.11.0
Node Version
16.16.0
Publised On
06 May 2023
Cumulative downloads
Total Downloads
Last day
6.8%
98,204
Compared to previous day
Last week
-13.7%
455,351
Compared to previous week
Last month
13.8%
2,042,764
Compared to previous month
Last year
120%
20,343,807
Compared to previous year
1
Since last update of UTIF was 18/6/2019 and Photopea does not touch npm at all and neither 3rd party developer is keeping package up to date with GitHub repo... this package is just updated version of utif (from npm) but with many improvements.
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
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- 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-01-27
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