{"_id":"upng-js","_rev":"9-108c71b8c05ca27cc179fc68ed61c1a3","name":"upng-js","description":"Small, fast and advanced PNG / APNG encoder and decoder","dist-tags":{"latest":"2.1.0"},"versions":{"1.0.0":{"name":"upng-js","description":"Fast and advanced PNG encoder/decoder","version":"1.0.0","homepage":"https://github.com/photopea/UPNG.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/UPNG.js.git"},"bugs":{"url":"https://github.com/photopea/UPNG.js/issues"},"main":"UPNG","keywords":["tiff","image","conversion"],"dependencies":{"pako":"^1.0.5"},"gitHead":"cf8ad8d9ff00f3abe3cc705f51dc56a8ecb17fc6","_id":"upng-js@1.0.0","scripts":{},"_shasum":"4ee9fca443c38ef12f2ee397e1d27649dc6b9042","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.2","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"4ee9fca443c38ef12f2ee397e1d27649dc6b9042","tarball":"https://registry.npmjs.org/upng-js/-/upng-js-1.0.0.tgz","integrity":"sha512-eDZUZxiV3ExUhuY6aURqHlO5i6GleXGvb2Pu1L3kr3Jhtc+GOMLryGBRnzZDRFRjbupg2qSplO/Z0RxB44bO5g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCwWkHGajFh30Y8A36T8Xbk9vgDqtkcyBtgWAxJ+6OYKAIgNvw55XYGfTb8Ly+A4bBpoBkRwAs7avMKuzt/9an1IYs="}]},"maintainers":[{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/upng-js-1.0.0.tgz_1502106063729_0.29325491352938116"}},"1.0.1":{"name":"upng-js","description":"Fast and advanced PNG encoder/decoder","version":"1.0.1","homepage":"https://github.com/photopea/UPNG.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/UPNG.js.git"},"bugs":{"url":"https://github.com/photopea/UPNG.js/issues"},"main":"UPNG","keywords":["png","image","conversion"],"dependencies":{"pako":"^1.0.5"},"gitHead":"aed8bbbc6cf6d0d5da04235150b25d11f7dd306f","_id":"upng-js@1.0.1","scripts":{},"_shasum":"79a4be4977aa4f59bd8746fa0f2a642000367b3f","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.2","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"79a4be4977aa4f59bd8746fa0f2a642000367b3f","tarball":"https://registry.npmjs.org/upng-js/-/upng-js-1.0.1.tgz","integrity":"sha512-sbYCMd7i1elk9ZsE28ZFXg1Jv+k2EzZHm78yuyJPB3jytHUHulbHWBhOuocCVhijzBTVxEoj1FIyaIfm+mDrfA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBdLJWvx4LqrQQ3wdM/JXHeZlBLFdUBd4/Z3Rat/ZXPqAiEAx1NZM/rrnrDiyG8mbjOmC6iMW2UV+3leBQfnxwnh6JQ="}]},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/upng-js-1.0.1.tgz_1503489979324_0.5869140671566129"}},"2.0.0":{"name":"upng-js","description":"Small, fast and advanced PNG / APNG encoder and decoder","version":"2.0.0","homepage":"https://github.com/photopea/UPNG.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/UPNG.js.git"},"bugs":{"url":"https://github.com/photopea/UPNG.js/issues"},"main":"UPNG","keywords":["png","apng","image","conversion"],"dependencies":{"pako":"^1.0.5"},"gitHead":"c62ddc812f23abe629134e8a1527f48fe5dab2c1","_id":"upng-js@2.0.0","scripts":{},"_shasum":"947b7bd26df602e2b5307d0e995481c38b345fcc","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.3","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"shasum":"947b7bd26df602e2b5307d0e995481c38b345fcc","tarball":"https://registry.npmjs.org/upng-js/-/upng-js-2.0.0.tgz","integrity":"sha512-Qfs+lA4gNKfLxM3i7yKplQDmE4iBQ7QTTj37YJRWIki7GIcHEan4jOs6X3ivMAlrfKM/LaA9eG0Rvp3E7NYPJA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD5n8WWU806MUSYO3hrVPiHiuM91uBHQhwl5dg5o5cVSAIhAKlOzYBEvnbW2vq/+OuIBUNSRz+DIyLNHVhDf+qUYmG2"}]},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/upng-js-2.0.0.tgz_1506954632091_0.2146743864286691"}},"2.1.0":{"name":"upng-js","description":"Small, fast and advanced PNG / APNG encoder and decoder","version":"2.1.0","homepage":"https://github.com/photopea/UPNG.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/UPNG.js.git"},"bugs":{"url":"https://github.com/photopea/UPNG.js/issues"},"main":"UPNG","keywords":["png","apng","image","conversion"],"dependencies":{"pako":"^1.0.5"},"gitHead":"5e5af183a3dda1e320b90a1830b3f64bc92010d4","_id":"upng-js@2.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.8.1","_npmUser":{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"},"dist":{"integrity":"sha512-d3xzZzpMP64YkjP5pr8gNyvBt7dLk/uGI67EctzDuVp4lCZyVMo0aJO6l/VDlgbInJYDY6cnClLoBp29eKWI6g==","shasum":"7176e73973db361ca95d0fa14f958385db6b9dd2","tarball":"https://registry.npmjs.org/upng-js/-/upng-js-2.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCE/w10OQsXjlR5/0Wd6Q7NuCMRrSZwKMWTwKGTnFOi8wIgI75PPApGFwKcbBbQ9iZmvpG3ek19uTpgBSKKxo/TLmI="}]},"maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/upng-js-2.1.0.tgz_1513076330420_0.16259562596678734"}}},"readme":"# UPNG.js\nA small, fast and advanced PNG / APNG encoder and decoder. It is the main PNG engine for [Photopea image editor](https://www.photopea.com).\n\n* [Examples of PNGs minified by UPNG.js](https://blog.photopea.com/png-minifier-inside-photopea.html#examples)\n* [Try UPNG.js in Photopea](https://www.photopea.com) - open an image and press File - Save for web, play with the Quality\n* [UPNG.Photopea.com](http://upng.photopea.com) - a separate minifier app, that uses UPNG.js\n* Support us by [making a donation](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ivan%40kuckir%2ecom&lc=CZ&item_name=UPNG%2ejs&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted).\n\nDownload and include the `UPNG.js` file in your code, or get it from NPM:\n\n```sh\nnpm install upng-js\n```\n\n## Encoder\n\nUPNG.js supports APNG and the interface expects \"frames\". Regular PNG is just a single-frame animation (single-item array).\n\n#### `UPNG.encode(imgs, w, h, cnum, [dels])`\n* `imgs`: array of frames. A frame is an ArrayBuffer containing the pixel data (RGBA, 8 bits per channel)\n* `w`, `h` : width and height of the image\n* `cnum`: number of colors in the result;  0: all colors (lossless PNG)\n* `dels`: array of delays for each frame (only when 2 or more frames)\n* returns an ArrayBuffer with binary data of a PNG file\n\nUPNG.js can do a lossy minification of PNG files, similar to [TinyPNG](https://tinypng.com/) and other tools. It performs color quantization using the [k-means algorithm](https://en.wikipedia.org/wiki/K-means_clustering).\n\nLossy compression is allowed by the last parameter `cnum`. Set it to zero for a lossless compression, or write the number of allowed colors in the image. Smaller values produce smaller files. **Or just use 0 for lossless / 256 for lossy.**\n\n## Decoder\n\nSupports all color types (including Grayscale and Palettes), all channel depths (1, 2, 4, 8, 16), interlaced images etc. Opens PNGs which other libraries can not open (tested with [PngSuite](http://www.schaik.com/pngsuite/)).\n\n#### `UPNG.decode(buffer)`\n* `buffer`: ArrayBuffer containing the PNG file\n* returns an image object with following properties:\n* * `width`: the width of the image\n* * `height`: the height of the image\n* * `depth`: number of bits per channel\n* * `ctype`: color type of the file (Truecolor, Grayscale, Palette ...)\n* * `frames`: additional info about frames (frame delays etc.)\n* * `tabs`: additional chunks of the PNG file\n* * `data`: pixel data of the image\n\nPNG files may have a various number of channels and a various color depth. The interpretation of `data` depends on the current color type and color depth (see the [PNG specification](https://www.w3.org/TR/PNG/)).\n\n#### `UPNG.toRGBA8(img)`\n* `img`: PNG image object (returned by UPNG.decode())\n* returns an array of frames. A frame is ArrayBuffer of the image in RGBA format, 8 bits per channel.\n\n### Example\n    var img  = UPNG.decode(buff);        // put ArrayBuffer of the PNG file into UPNG.decode\n    var rgba = UPNG.toRGBA8(img)[0];     // UPNG.toRGBA8 returns array of frames, size: width * height * 4 bytes.\n\nPNG format uses the Inflate algorithm. Right now, UPNG.js calls [Pako.js](https://github.com/nodeca/pako) for the Inflate and Deflate method.\n","maintainers":[{"name":"photopea","email":"support@photopea.com"},{"name":"scimonster","email":"tehalmightyscimonster@gmail.com"}],"time":{"modified":"2022-06-28T05:50:24.755Z","created":"2017-08-07T11:41:04.706Z","1.0.0":"2017-08-07T11:41:04.706Z","1.0.1":"2017-08-23T12:06:21.353Z","2.0.0":"2017-10-02T14:30:33.538Z","2.1.0":"2017-12-12T10:58:51.288Z"},"homepage":"https://github.com/photopea/UPNG.js","keywords":["png","apng","image","conversion"],"repository":{"type":"git","url":"git+https://github.com/photopea/UPNG.js.git"},"contributors":[{"name":"Scimonster","url":"https://github.com/Scimonster"}],"author":{"name":"photopea","url":"https://github.com/photopea"},"bugs":{"url":"https://github.com/photopea/UPNG.js/issues"},"license":"MIT","readmeFilename":"README.md","users":{"shuoshubao":true,"tianyk":true}}