4.1.2 • Published 8 years ago
gulp-image-sans-guetzli v4.1.2
gulp-image-sans-guetzli
Optimize PNG, JPEG, GIF, SVG images with gulp task. Fork of original gulp-image, without the unsupported guetzli package.

Install
$ npm install --save-dev gulp-imageExternal Dendencies
brew install libjpeg libpngon macOSapt-get install -y libjpeg libpngon Ubuntu
Usage
This is an example of gulpfile.js.
const gulp = require('gulp');
const image = require('gulp-image');
gulp.task('image', function () {
gulp.src('./fixtures/*')
.pipe(image())
.pipe(gulp.dest('./dest'));
});
gulp.task('default', ['image']);You can pass an object to image() as argument such as following:
gulp.task('image', function () {
gulp.src('./fixtures/*')
.pipe(image({
pngquant: true,
optipng: false,
zopflipng: true,
jpegRecompress: false,
mozjpeg: true,
gifsicle: true,
svgo: true,
concurrent: 10
}))
.pipe(gulp.dest('./dest'));
});Set false for optimizers which you don't want to apply. And you can set concurrent option to limit the max concurrency in execution.
You can configure parameters applied to each optimizers such as following:
options: {
optipng: ['-i 1', '-strip all', '-fix', '-o7', '-force'],
pngquant: ['--speed=1', '--force', 256],
zopflipng: ['-y', '--lossy_8bit', '--lossy_transparent'],
jpegRecompress: ['--strip', '--quality', 'medium', '--min', 40, '--max', 80],
mozjpeg: ['-optimize', '-progressive'],
gifsicle: ['--optimize'],
svgo: ['--enable', 'cleanupIDs', '--disable', 'convertColors']
}License
MIT © Copyright Shogo Sensui for original fork of gulp-image