0.9.6 • Published 1 year ago
zopflipng v0.9.6
zopflipng
zopflipng is a native addon module of google's zopflipng.
!WARNING
Curently this package can only run on unix-like systems!WARNING
Currently this package doesn't use pre-built binaries. It builds addon from source code while package is installed. Compilation process usesCmake,MakeorNinjaandGCCso these binaries should be in the path.
Install
npm install zopflipngExample
npm install pngjsimport fs from "fs/promises";
import { optimize } from "zopflipng";
const pngContent = await fs.readFile(
"node_modules/pngquantjs/assets/nodejs.png"
);
const options = {
verbose: true,
lossy_transparent: false,
lossy_8bit: false,
filter_strategies: [],
auto_filter_strategy: true,
keep_colortype: false,
keepchunks: [],
use_zopfli: true,
num_iterations: 15,
num_iterations_large: 5,
};
optimize(pngContent, options);Contribution
Development
git clone https://github.com/diodeiot/zopflipng --recursive
cd zopflipng
yarn
yarn buildWhen contributing code, please write relevant tests and run npm test before submitting pull requests.
License
MIT