{"_id":"utif","_rev":"359263","name":"utif","description":"Fast and advanced TIFF decoder","dist-tags":{"latest":"3.1.0"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"time":{"modified":"2021-07-13T08:45:11.000Z","created":"2017-08-03T11:26:35.665Z","3.1.0":"2019-06-18T08:37:46.792Z","3.0.0":"2019-02-11T14:02:46.994Z","2.0.1":"2018-09-01T21:03:33.405Z","2.0.0":"2018-05-10T08:00:57.642Z","1.3.0":"2018-02-06T08:39:29.530Z","1.2.1":"2017-12-23T19:11:45.277Z","1.2.0":"2017-12-21T22:14:06.178Z","1.1.2":"2017-09-25T08:17:32.546Z","1.1.1":"2017-09-19T10:38:25.175Z","1.1.0":"2017-08-07T11:28:11.442Z","1.0.0":"2017-08-03T11:26:35.665Z"},"users":{},"author":{"name":"photopea","url":"https://github.com/photopea"},"repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"versions":{"3.1.0":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"3.1.0","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"pako":"^1.0.5"},"gitHead":"27f1098a67c3cfd4348c9b8fd887fcd8cd171095","_id":"utif@3.1.0","_npmVersion":"6.4.0","_nodeVersion":"10.9.0","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"4abec2f5d9cafe7813c0191e007927c125401f1c","size":22318,"noattachment":false,"key":"/utif/-/utif-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-3.1.0.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif_3.1.0_1560847066678_0.5112038678392328"},"_hasShrinkwrap":false,"publish_time":1560847066792,"_cnpm_publish_time":1560847066792},"3.0.0":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"3.0.0","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"pako":"^1.0.5"},"gitHead":"a91099f1888e0d77cda228d71ef213b9b308b3bb","_id":"utif@3.0.0","_npmVersion":"6.4.0","_nodeVersion":"10.9.0","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"94fead8cfcbfa9687d679307fbc41d635c1376e1","size":21178,"noattachment":false,"key":"/utif/-/utif-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-3.0.0.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif_3.0.0_1549893766856_0.05824767314241264"},"_hasShrinkwrap":false,"publish_time":1549893766994,"_cnpm_publish_time":1549893766994},"2.0.1":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"2.0.1","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"pako":"^1.0.5"},"gitHead":"1ba12779ddfdfa50b0593cffec056a19c98c0f6f","_id":"utif@2.0.1","_npmVersion":"6.2.0","_nodeVersion":"10.8.0","_npmUser":{"name":"alisowski","email":"lisowski54@gmail.com"},"dist":{"shasum":"9e1582d9bbd20011a6588548ed3266298e711759","size":20040,"noattachment":false,"key":"/utif/-/utif-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-2.0.1.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif_2.0.1_1535835813184_0.735027429987511"},"_hasShrinkwrap":false,"publish_time":1535835813405,"_cnpm_publish_time":1535835813405},"2.0.0":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"2.0.0","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"jpgjs":"github:makr28/jpgjs","pako":"^1.0.5"},"gitHead":"4f1b10cb09e244cfd4f9631245d2231537148be7","_id":"utif@2.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.8.1","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"417d87db8504fe7d51c07d03ef6be00e6e4aadfc","size":14403,"noattachment":false,"key":"/utif/-/utif-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-2.0.0.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif_2.0.0_1525939257494_0.14049340304136737"},"_hasShrinkwrap":false,"publish_time":1525939257642,"_cnpm_publish_time":1525939257642},"1.3.0":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"1.3.0","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"jpgjs":"github:notmasteryet/jpgjs","pako":"^1.0.5"},"gitHead":"c0e0445b0eabea2734b319a40eff492269544f46","_id":"utif@1.3.0","_npmVersion":"5.6.0","_nodeVersion":"8.8.1","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"d527e94d979eb58fe7b2c47674b52ac64fd61143","size":12692,"noattachment":false,"key":"/utif/-/utif-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-1.3.0.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif-1.3.0.tgz_1517906368589_0.7302788160741329"},"directories":{},"publish_time":1517906369530,"_hasShrinkwrap":false,"_cnpm_publish_time":1517906369530},"1.2.1":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"1.2.1","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"jpgjs":"github:notmasteryet/jpgjs","pako":"^1.0.5"},"gitHead":"226f2c93e0f9469215983e4361f88d8f5d13c312","_id":"utif@1.2.1","_npmVersion":"5.6.0","_nodeVersion":"8.8.1","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"1c155b714f2d0a9f630e11d9626f41764baac2a7","size":12434,"noattachment":false,"key":"/utif/-/utif-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-1.2.1.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif-1.2.1.tgz_1514056304356_0.5327416572254151"},"directories":{},"publish_time":1514056305277,"_hasShrinkwrap":false,"_cnpm_publish_time":1514056305277},"1.2.0":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"1.2.0","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"jpgjs":"github:notmasteryet/jpgjs","pako":"^1.0.5"},"gitHead":"be6e10e1fe46485766266c4e40283bd451eafe42","_id":"utif@1.2.0","_npmVersion":"5.6.0","_nodeVersion":"8.8.1","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"56002026ec9e294e619806d685fc450af601d334","size":12200,"noattachment":false,"key":"/utif/-/utif-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-1.2.0.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif-1.2.0.tgz_1513894445267_0.4096751972101629"},"directories":{},"publish_time":1513894446178,"_hasShrinkwrap":false,"_cnpm_publish_time":1513894446178},"1.1.2":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"1.1.2","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"jpgjs":"github:notmasteryet/jpgjs","pako":"^1.0.5"},"gitHead":"b693d2853658203a4281aec854abe76ec18efcbb","_id":"utif@1.1.2","scripts":{},"_shasum":"8477ae29fc6d06e5976deeafa702b03f90f74c68","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.3","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"8477ae29fc6d06e5976deeafa702b03f90f74c68","size":10129,"noattachment":false,"key":"/utif/-/utif-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-1.1.2.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif-1.1.2.tgz_1506327451603_0.17123203678056598"},"directories":{},"publish_time":1506327452546,"_cnpm_publish_time":1506327452546,"_hasShrinkwrap":false},"1.1.1":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"1.1.1","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"jpgjs":"github:notmasteryet/jpgjs","pako":"^1.0.5"},"gitHead":"d118e7ac7acb0fc8751e4c513abf8e58dc0aa2aa","_id":"utif@1.1.1","scripts":{},"_shasum":"28dac671a4ec2b99f4a3b7b384b7b87534f5b6e8","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.3","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"28dac671a4ec2b99f4a3b7b384b7b87534f5b6e8","size":10117,"noattachment":false,"key":"/utif/-/utif-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-1.1.1.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif-1.1.1.tgz_1505817504264_0.7957097936887294"},"directories":{},"publish_time":1505817505175,"_hasShrinkwrap":false,"_cnpm_publish_time":1505817505175},"1.1.0":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"1.1.0","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"jpgjs":"github:notmasteryet/jpgjs","pako":"^1.0.5"},"gitHead":"0ce0a1dd279313a2dadcea6f57d166550c6727ed","_id":"utif@1.1.0","scripts":{},"_shasum":"fc18c9bb013d7e611933e8456861ee124105269f","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.2","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"fc18c9bb013d7e611933e8456861ee124105269f","size":10022,"noattachment":false,"key":"/utif/-/utif-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-1.1.0.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif-1.1.0.tgz_1502105290397_0.23678578482940793"},"directories":{},"publish_time":1502105291442,"_hasShrinkwrap":false,"_cnpm_publish_time":1502105291442},"1.0.0":{"name":"utif","description":"Fast and advanced TIFF decoder","version":"1.0.0","homepage":"https://github.com/photopea/UTIF.js","author":{"name":"photopea","url":"https://github.com/photopea"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/photopea/UTIF.js.git"},"bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"main":"UTIF","keywords":["tiff","image","conversion"],"dependencies":{"pako":"^1.0.5"},"gitHead":"da0761cf96d823459caeaaa9ce94476fce90be29","_id":"utif@1.0.0","scripts":{},"_shasum":"8b58ba57424ef1ef35bc8251d0722a68d661295b","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.2","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"8b58ba57424ef1ef35bc8251d0722a68d661295b","size":9528,"noattachment":false,"key":"/utif/-/utif-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/utif/download/utif-1.0.0.tgz"},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/utif-1.0.0.tgz_1501759594675_0.5360342918429524"},"directories":{},"publish_time":1501759595665,"_hasShrinkwrap":false,"_cnpm_publish_time":1501759595665}},"readme":"# UTIF.js\nA 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](https://www.photopea.com). Try to open your TIFF file with Photopea to see, if UTIF.js can parse it.\n\n* Supports Black & White, Grayscale, RGB and Paletted images\n* Supports Fax 3 and Fax 4 (CCITT), JPEG, LZW, PackBits and other compressions (1,3,4,5,6,7,8,32773,32809)\n* E.g. [this 8 MPix image](//www.photopea.com/api/img/G4.TIF) with Fax 4 compression is just 56 kB ( [Open in Photopea](https://www.photopea.com?p=%7B%22files%22:%5B%22//www.photopea.com/api/img/G4.TIF%22%5D%7D) )\n\nFor 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.\n\n## Installation\n\nDownload and include the `UTIF.js` file in your code. If you're in NodeJS or otherwise using NPM, run:\n\n```sh\nnpm install utif\n```\n\n#### `UTIF.decode(buffer)`\n* `buffer`: ArrayBuffer containing TIFF or EXIF data\n* returns an array of \"IFDs\" (image file directories). Each IFD is an object, keys are \"tXYZ\" (XYZ is a TIFF tag number), values are values of these tags. You can get the the dimension (and other properties, \"metadata\") of the image without decompressing pixel data.\n\n#### `UTIF.decodeImage(buffer, ifd)`\n* `buffer`: ArrayBuffer containing TIFF or EXIF data\n* `ifd`: the element of the output of UTIF.decode()\n* If there is an image inside the IFD, it is decoded and three new properties are added to the IFD:\n* * `width`: the width of the image\n* * `height`: the height of the image\n* * `data`: decompressed pixel data of the image\n\nTIFF files may have various number of channels and various color depth. The interpretation of `data` depends on many tags (see the [TIFF 6 specification](http://www.npes.org/pdf/TIFF-v6.pdf)). The following function converts any TIFF image into a 8-bit RGBA image.\n\n#### `UTIF.toRGBA8(ifd)`\n* `ifd`: image file directory (element of \"ifds\" returned by UTIF.decode(), processed by UTIF.decodeImage())\n* returns Uint8Array of the image in RGBA format, 8 bits per channel (ready to use in context2d.putImageData() etc.)\n\n### Example\n\n```javascript\nfunction imgLoaded(e) {\n  var ifds = UTIF.decode(e.target.response);\n  UTIF.decodeImage(e.target.response, ifds[0])\n  var rgba  = UTIF.toRGBA8(ifds[0]);  // Uint8Array with RGBA pixels\n  console.log(ifds[0].width, ifds[0].height, ifds[0]);\n}\n\nvar xhr = new XMLHttpRequest();\nxhr.open(\"GET\", \"my_image.tif\");\nxhr.responseType = \"arraybuffer\";\nxhr.onload = imgLoaded;   xhr.send();\n```\n## Use TIFF images in HTML\n\nIf 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.\n\n#### `UTIF.replaceIMG()`\n```html\n<body onload=\"UTIF.replaceIMG()\">\n...\n<img src=\"image.tif\" />  <img src=\"dog.tif\" /> ...\n```\nAnd 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.\n\n## Encoding TIFF images\n\nYou should not save images into TIFF format in the 21st century. Save them as PNG instead (e.g. using [UPNG.js](https://github.com/photopea/UPNG.js)). If you still want to use TIFF format for some reason, here it is.\n\n#### `UTIF.encodeImage(rgba, w, h, metadata)`\n* `rgba`: ArrayBuffer containing RGBA pixel data\n* `w`: image width\n* `h`: image height\n* `metadata` [optional]: IFD object (see below)\n* returns ArrayBuffer of the binary TIFF file. No compression right now.\n\n#### `UTIF.encode(ifds)`\n* `ifds`: array of IFDs (image file directories). An IFD is a JS object with properties \"tXYZ\" (where XYZ are TIFF tags)\n* returns ArrayBuffer of binary data. You can use it to encode EXIF data.\n\n## Dependencies\nTIFF format sometimes uses Inflate algorithm for compression (but it is quite rare). Right now, UTIF.js calls [Pako.js](https://github.com/nodeca/pako) for the Inflate method.\n","_attachments":{},"homepage":"https://github.com/photopea/UTIF.js","bugs":{"url":"https://github.com/photopea/UTIF.js/issues"},"license":"MIT"}