Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

pngquant

papandreou31.2kBSD-3-Clause4.2.0TypeScript support: included

The pngquant utility as a readable/writable stream

pngquant, png, image, optimization, stream, filter, read/write, duplex

readme

node-pngquant

NPM version Build Status Coverage Status Dependency Status

The pngquant command line utility as a readable/writable stream.

The constructor optionally takes an array of command line options for the pngquant binary (defaults to [256]):

import PngQuant from 'pngquant';

const myPngQuanter = new PngQuant([192, '--quality', '60-80', '--nofs', '-']);

sourceStream.pipe(myPngQuanter).pipe(destinationStream);

PngQuant as a web service (sends back a png with the number of colors quantized to 128):

import PngQuant from 'pngquant';
import http from 'http';

http
  .createServer(function (req, res) {
    if (req.headers['content-type'] === 'image/png') {
      res.writeHead(200, { 'Content-Type': 'image/png' });
      req.pipe(new PngQuant([128])).pipe(res);
    } else {
      res.writeHead(400);
      res.end('Feed me a PNG!');
    }
  })
  .listen(1337);

Installation

Make sure you have node.js and npm installed, and that the pngquant binary is in your PATH, then run:

npm install pngquant

Releases

See the changelog.

License

3-clause BSD license -- see the LICENSE file for details.

changelog

v4.2.0 (2023-07-20)

Pull requests

Commits to master

v4.1.0 (2022-09-20)

Pull requests

Commits to master

v4.0.0 (2021-02-13)

Pull requests

Commits to master

v3.1.0 (2020-07-22)

Pull requests

Commits to master

v3.0.0 (2019-05-23)

Pull requests

Commits to master

v2.0.1 (2019-03-03)

Pull requests

Commits to master

v2.0.0 (2018-03-16)

v1.3.0 (2017-04-27)

v1.2.0 (2017-01-21)

Pull requests

Commits to master

v1.1.1 (2016-07-21)

Pull requests

Commits to master

v1.1.0 (2016-07-19)

v1.0.0 (2016-03-31)

v0.6.0 (2015-09-20)

v0.5.0 (2015-07-29)

v0.4.0 (2014-11-14)

  • #4 Added error handler for stdin and stdout. (freezy)

v0.3.0 (2014-10-21)

v0.2.0 (2014-09-22)

v0.1.5 (2014-05-28)

v0.1.4 (2014-03-26)

v0.1.3 (2014-03-25)

v0.1.2 (2014-03-25)

v0.1.1 (2014-03-22)

v0.1.0

Pull requests

  • #1 Use pngquant-bin to avoid local OS pngquant requirement (Peter Müller)

Commits to master

v0.0.3

v0.0.2

v0.0.1