{"_id":"jspngopt","_rev":"4-92c4fb56c9d11c2b34d405366f7d55fa","name":"jspngopt","description":"PNG optimizer, similar to optipng","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"jspngopt","version":"0.1.0","description":"PNG optimizer, similar to optipng","main":"src/index.js","scripts":{"test":"mocha --slow 300 && jshint --verbose src/*.js test/*.js"},"repository":{"type":"git","url":"git+https://github.com/gagern/jspngopt.git"},"keywords":["png","compress","compression","file","size","minify"],"author":{"name":"Martin von Gagern"},"license":"MIT","bugs":{"url":"https://github.com/gagern/jspngopt/issues"},"homepage":"https://github.com/gagern/jspngopt#readme","devDependencies":{"jshint":"^2.8.0","mocha":"^2.2.5","pako":"^0.2.7","should":"^7.1.0","vendor-icons":"0.3.6"},"dependencies":{"buffer-crc32":"^0.2.5"},"bin":{"jspngopt":"./src/cli.js"},"engines":{"node":">=0.11"},"gitHead":"b3e1f4524b86da8e8d26f538a5cc558fd74b8cb7","_id":"jspngopt@0.1.0","_shasum":"15e24f15c1c95612da355497fc41d444d2f8443f","_from":".","_npmVersion":"2.11.3","_nodeVersion":"0.12.7","_npmUser":{"name":"gagern","email":"Martin.vGagern@gmx.net"},"dist":{"shasum":"15e24f15c1c95612da355497fc41d444d2f8443f","tarball":"https://registry.npmjs.org/jspngopt/-/jspngopt-0.1.0.tgz","integrity":"sha512-y+cuboxIeQgxCoES/TF2Oq4Cg7bRPtkmmUEd5uHfExp46+QT/gnAVTme9wcW+C4RKsvuuvfSiHW2+YlOw4t7PA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhDW5U7W+pT+4BgHZHZhhlzg3Y1i6RYFu1FKAAxxVN/gIhAPg/klNdyNYkmYoGU437nqfuPcj0l5ovqj/iHsTIEu2V"}]},"maintainers":[{"name":"gagern","email":"Martin.vGagern@gmx.net"}]},"0.2.0":{"name":"jspngopt","version":"0.2.0","description":"PNG optimizer, similar to optipng","main":"src/index.js","scripts":{"test":"mocha --slow 300 && jshint --verbose src/*.js test/*.js"},"repository":{"type":"git","url":"git+https://github.com/gagern/jspngopt.git"},"keywords":["png","compress","compression","file","size","minify"],"author":{"name":"Martin von Gagern"},"license":"MIT","bugs":{"url":"https://github.com/gagern/jspngopt/issues"},"homepage":"https://github.com/gagern/jspngopt#readme","devDependencies":{"jshint":"^2.8.0","mocha":"^3.2.0","pako":"^1.0.4","should":"^11.1.2"},"dependencies":{"buffer-crc32":"^0.2.5"},"bin":{"jspngopt":"./src/cli.js"},"engines":{"node":">=0.11"},"gitHead":"3146a4e50ede6d0b53e840f477204908265e193b","_id":"jspngopt@0.2.0","_shasum":"a05e4625bc64ef06a54f11763bc90b75a2dcf815","_from":".","_npmVersion":"3.10.10","_nodeVersion":"7.3.0","_npmUser":{"name":"gagern","email":"Martin.vGagern@gmx.net"},"dist":{"shasum":"a05e4625bc64ef06a54f11763bc90b75a2dcf815","tarball":"https://registry.npmjs.org/jspngopt/-/jspngopt-0.2.0.tgz","integrity":"sha512-hQ/F4ZRom0/PV9MG0V1jTGTXJ/A1WeuURUCcA4W4a9kppuSFTQOcy/3d6/hI9FRwFGHW75K7Iv8lXOUzc6M/Fg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCPIXbNPQZVT4BF4xQBEEqY63d8OGPaPsz2Y5FCk/yZOQIhAKhMVbhkmUUAIH9eCVdhTQHwixuFruMS+iEa45qQxteq"}]},"maintainers":[{"name":"gagern","email":"Martin.vGagern@gmx.net"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/jspngopt-0.2.0.tgz_1482401558194_0.5279040352907032"}}},"readme":"# jspngopt\n\n**PNG optimizer, similar to OptiPNG**\n\n[![npm version](https://img.shields.io/npm/v/jspngopt.svg)](https://www.npmjs.com/package/jspngopt)\n[![Travis build status](https://api.travis-ci.org/gagern/jspngopt.svg?branch=master)](https://travis-ci.org/gagern/jspngopt)\n\n`jspngopt` is a tool which tries to reduce the file size of a PNG file by\n\n* removing the alpha channel of an opaque image\n* converting a grayscale-only image to a grayscale color mode\n* trying out different pixel prediction filters\n* trying out different zlib compression parameter combinations\n\nThis is very similar to the [OptiPNG](http://optipng.sourceforge.net/) tool.\nHowever, there is no shared code, and this implementation is written\n*completely in JavaScript*. It will usually make use of the\n[zlib bindings](https://nodejs.org/api/zlib.html) provided by node.js,\nmaking use of the performance of native code there.\nBut it is also possible to use [pako](http://nodeca.github.io/pako/)\nor similar libraries to provide a portable all-JavaScript setup.\nUsing a fixed version of pako on node.js will ensure reproducible results,\nbut may result in slightly larger files compared to the latest native zlib.\n\n## Installation\n\nOn node.js, simply do\n\n```sh\nnpm install jspngopt\n```\n\nA version which supports browserify is planned.\nIf you need things packaged for some other environment,\nplease file a ticket explaining your setup.\n\n## Command-line usage\n\nThe command line interface of `jspngopt` is intended to be\nmostly compatible with the one from `optipng`.\nBut as this project is in the early stages of development,\ncurrently the only thing accepted on the command line is a list of file names,\nwhich will be optimized with the default settings,\nthe results overwriting the input files if there was a size reduction.\n\n## API\n\nThe central element of the API is the `Optimizer` object.\n\n```js\nvar jspngopt = require(\"jspngopt\");\nvar opt = new jspngopt.Optimizer();\nvar optimized = opt.bufferSync(unoptimized);\n```\n\n### Options\n\nThe `Optimizer` constructor takes an `options` dictionary.\nIt may contain the following elements:\n\n* **matrices:** An array of objects, each of which describes a collection of\n  possible compression parameters. The keys of each such objects are the same\n  described below for parameters, while the values are arrays listing all the\n  values which should be tried for a given parameter. The default corresponds\n  to the default of `optipng`.\n* **pako:** The `pako` module, as returned from `require(\"pako\")`.\n  Setting this option will use `pako` instead of `zlib`,\n  ensuring reproducible results but possibly sacrificing performance\n  and compression rate.\n* **deflateSync:** A function which is functionally equivalent\n  to `zlib.deflateSync` and which should be used in its stead.\n* **maxIdatLength:** Maximal size of an `IDAT` chunk, defaults to `0x7fffffff`.\n  This is the length of the raw data payload, excluding header and checksum.\n* **log:** Function to call when logging output (at `verbosity` > 0).\n  Defaults to `console.log`.\n* **verbosity:** Amount of information printed during processing.\n  The default of 0 avoids all logging.\n  With a setting of 1, the best parameter combination will get printed.\n  At a setting of 2, all the parameter combinations will get printed.\n\n### Parameters\n\nEach parameter combination is described by the following numbers:\n\n* **filters:** Which filters to try. Numbers 0 through 4 correspond to the\n  filters *None* through *Paeth* described in the PNG specification.\n  Filter 5 corresponds to an adaptive choice of filters which minimizes\n  the sum of the absolute values in each row.\n  Default: `[0, 5]`.\n* **interlace:** 0 disables interlacing, while 1 will eventually enable\n  Adam7 interlacing. Right now interlacing is not supported yet.\n  Default: `[0]`.\n* **windowBits:** Base-two logarithm of the size of the sliding window\n  used to find redundant data.\n  Valid values are in the range from 8 through 15.\n  Default: `[15]`.\n* **level:** Compression level, in the range from 0 (no compression)\n  to 9 (best compression).\n  Default: `[9]`.\n* **memLevel:** Memory usage level, from 1 (little memory) to 9 (large memory).\n  Default: `[8, 9]`.\n* **strategy:** Compression strategy.\n  * 0 is the `DEFAULT_STRATEGY` used for generic data.\n  * 1 is `FILTERED`, optimized for the fact that numbers are likely small.\n  * 2 is `HUFFMANN_ONLY` to not match duplicates at all.\n  * 3 is `RLE`, performing only run-length encoding.\n  * 4 is `FIXED` uses a fixed Huffmann coding table.\n\n  Default: `[0, 1, 2, 3]`.\n\n### Methods of Optimizer instances\n\n#### bufferSync(Buffer) → Buffer\n\nTakes the content of a complete PNG file as input,\nand returns an optimized version on output.\nWill throw an exception in case of an error.\n\n#### fileSync(String) → void\n\nTakes the name of a PNG file which will be read,\noptimized and written to the same location.\nWill throw an exception in case of an error.\nThis method is not available in the browserified version.\n","maintainers":[{"name":"gagern","email":"Martin.vGagern@gmx.net"}],"time":{"modified":"2022-06-19T06:53:14.591Z","created":"2015-08-29T23:44:02.003Z","0.1.0":"2015-08-29T23:44:02.003Z","0.2.0":"2016-12-22T10:12:39.974Z"},"homepage":"https://github.com/gagern/jspngopt#readme","keywords":["png","compress","compression","file","size","minify"],"repository":{"type":"git","url":"git+https://github.com/gagern/jspngopt.git"},"author":{"name":"Martin von Gagern"},"bugs":{"url":"https://github.com/gagern/jspngopt/issues"},"license":"MIT","readmeFilename":"README.md"}