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