grunt-guetzli
v1.0.0
Published
Grunt plugin to compress JPG and PNG images according to Google's Guetzli algorithm.
Downloads
11
Maintainers
Readme
grunt-guetzli
Grunt plugin to compress JPG and PNG images according to Google's Guetzli algorithm.
Installation
You need to have Guetzli already installed on your system for this plugin to work. Download from the Guetzli releases page, or compile it yourself.
Run npm install --save grunt-guetzli
.
This will install the grunt-guetzli
plugin and its grunt
dependency if not already installed.
In your Gruntfile.js
, you can use the new guetzli
task as following:
guetzli: {
files: {
expand: true,
src: 'tmp/images/*.jpg',
dest: 'tmp/images-optimized'
},
options: {
quality: 84
}
}
Don't forget to load the plugin as well:
grunt.loadNpmTasks('grunt-guetzli');
Configuration
The source guetzli
binary does not expose many configuration options other than the quality and an option to enable verbose output. Currently, Guetzli binary also exposes an option to limit the memory limit, and those options will be added to this grunt plugin in a future release.
This plugin makes it possible to configure the quality, verbose option, and specify the guetzli
binary path if it's not in the system PATH
.
Configuration options
quality
: The quality of the output image. Allows an integer between84
and100
. Default (fromguetzli
binary):95
.verbose
: Enables verbose output from theguetzli
binary. Note that this plugin provides the compression information for each file, and a summary at the end of operation even without this option.binpath
: Specify a custom path to theguetzli
binary if it is not already available in the path. If not given,guetzli
will be used. If the given path is not available or executable, Grunt will return an error with code127
.
Contributing
You are welcome to do so. Send a PR or create an issue in the Github repo.