optimize-png-for-web

yarn add optimize-png-for-web

Usage no npm install needed!

<script type="module">
  import optimizePngForWeb from 'https://cdn.skypack.dev/optimize-png-for-web';
</script>

README

Installation

yarn add optimize-png-for-web

Also, you need to install pngquant and zopflipng. On Mac you can do it via Brew; brew install pngquant and brew install zopfli respectively.

Usage

Check usage example in test.js file:

require('./src/index')('./sample-images', './out', {
    resizeTo1x2x: true,
    emitErrorsOnWarnings: false,
})

If resizeTo1x2x is false than images will not be resized.

If emitErrorsOnWarnings is true than all warning will produce errors and will stop script execution.