pngquant

The pngquant utility as a readable/writable stream

pngquant downloads pngquant version pngquant license

pngquant類似套件:
npm下載趨勢
3 年
🌟 在 pngquant 的 README.md 中顯示即時使用量圖表,只需複製下面的代碼。
## Usage Trend
[![Usage Trend of pngquant](https://npm-compare.com/img/npm-trend/THREE_YEARS/pngquant.png)](https://npm-compare.com/pngquant#timeRange=THREE_YEARS)
Cumulative GitHub Star Trend
🌟 在 pngquant 的 README.md 中顯示 GitHub stars 趨勢圖表,只需複製下面的代碼。
## GitHub Stars Trend
[![GitHub Stars Trend of pngquant](https://npm-compare.com/img/github-trend/pngquant.png)](https://npm-compare.com/pngquant)
統計詳情
套件
下載數
Stars
大小
Issues
發布時間
許可
pngquant4,8698317.9 kB42 年前BSD-3-Clause
pngquant 的 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.