The pngquant utility as a readable/writable stream

npm install pngquant
11 downloads in the last day
67 downloads in the last week
685 downloads in the last month


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]):

var PngQuant = require('pngquant'),
    myPngQuanter = new PngQuant([192, '-ordered']);


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

var PngQuant = require('pngquant'),
    http = require('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.end('Feed me a PNG!');


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

npm install pngquant


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

npm loves you