Clone or download
Latest commit 3a982bd Jun 16, 2018
Failed to load latest commit information.
screenshot add a screenshot Jul 6, 2015
test Remove jpegoptim Sep 3, 2017
.editorconfig Various tweaks May 19, 2016
.gitignore initial commit Feb 6, 2014
.travis.yml Add dependency Feb 9, 2018
index.js Support a `quiet` option. Feb 18, 2018
license Add a license file Mar 17, 2017
optimize.js Accepts manual parameters Oct 7, 2017
package-lock.json Update mozjpeg Jun 16, 2018
package.json Update mozjpeg Jun 16, 2018 Fix readme May 25, 2018


Optimize PNG, JPEG, GIF, SVG images with gulp task.

Build Status NPM version Dependency Status devDependency Status

gulp-image result


$ npm install --save-dev gulp-image

External Dendencies

  • brew install libjpeg libpng on macOS
  • apt-get install -y libjpeg libpng on Ubuntu


This is an example of gulpfile.js.

const gulp = require('gulp');
const image = require('gulp-image');

gulp.task('image', function () {

gulp.task('default', ['image']);

You can pass an object to image() as argument such as following:

gulp.task('image', () => {
      pngquant: true,
      optipng: false,
      zopflipng: true,
      jpegRecompress: false,
      mozjpeg: true,
      guetzli: false,
      gifsicle: true,
      svgo: true,
      concurrent: 10,
      quiet: true // defaults to false

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 also set quiet to avoid logging out results for every image processed.

You can configure parameters applied to each optimizers such as following:

gulp.task('image', () => {
      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'],
      guetzli: ['--quality', 85],
      gifsicle: ['--optimize'],
      svgo: ['--enable', 'cleanupIDs', '--disable', 'convertColors']


MIT © Shogo Sensui