papandreou/node-pngquant


The pngquant utility as a readable/writable stream

License: BSD-3-Clause

Language: JavaScript


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

var PngQuant = require('pngquant'),
    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):

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.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

License

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

Project Statistics

Sourcerank 10
Repository Size 72.3 KB
Stars 46
Forks 18
Watchers 3
Open issues 5
Dependencies 20
Contributors 8
Tags 21
Created
Last updated
Last pushed

Top Contributors See all

Andreas Lind Felix Schoeler Peter Müller Perry Huang Pascal Hartig freezy

Packages Referencing this Repo

pngquant
The pngquant utility as a readable/writable stream
Latest release 2.0.1 - Updated - 46 stars
jpegoptim-stream
The jpegoptim utility as a readable/writable stream
Latest release 2.0.1 - Updated - 46 stars

Recent Tags See all

v2.0.1 March 03, 2019
v2.0.0 March 16, 2018
v1.3.0 April 27, 2017
v1.2.0 January 21, 2017
v1.1.1 July 21, 2016
v1.1.0 July 19, 2016
v1.0.0 March 31, 2016
v0.6.0 September 20, 2015
v0.5.0 July 28, 2015
v0.4.0 November 14, 2014
v0.3.0 October 21, 2014
v0.2.0 September 22, 2014
v0.1.5 May 28, 2014
v0.1.4 March 26, 2014
v0.1.3 March 25, 2014

Something wrong with this page? Make a suggestion

Last synced: 2019-04-19 23:40:17 UTC

Login to resync this repository