JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 97
  • Score
    100M100P100Q82293F
  • License ISC

Compresses image streams using pngquant and mozjpeg

Package Exports

  • image-stream-compress

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (image-stream-compress) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Image Stream Compress

npm version

An image compression library for image streams (modified from node-pngquant). Uses pngquant and mozjpeg for compression

Installation

Simply install the npm module and you are good to go!

npm install image-stream-compress

Usage

const fs = require("fs");

const { BaseStream, PNGQuant, MozJPEG } = require("image-stream-compress");

const input = fs.createReadStream("image.png");
const output = fs.createReadStream("output.png");

const compress = new PNGQuant([ 256, "--speed", 5, "--quality", "65-80" ]);

input.pipe(compress)
  .pipe(output)
  .on("finish", () => console.log("Image compressed!"));

API

BaseStream (extends Stream)

 constructor(binaryPath: String, args: String[])

PNGQuant (extends BaseStream)

 constructor(args: String[])  A full list of args can be found here

MozJPEG (extends BaseStream)

 constructor(args: String[])  A full list of args can be found here

Contributing

Pull requests are welcome. Any changes are appreciated!

License

ISC

Acknowledgments

  • node-pngquant - Special thanks to all of the contributors who worked on that project! This project is a slight modfication of their project to make it used for more general purposes