Need help with gulp-image?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

1000ch
214 Stars 23 Forks MIT License 286 Commits 4 Opened issues

Description

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

Services available

!
?

Need anything else?

Contributors list

# 39,460
imagemi...
vuejs
HTML
Electro...
237 commits
# 688,791
JavaScr...
Gulp
2 commits
# 379,027
gitlab-...
android...
JavaScr...
Gulp
1 commit
# 347,966
JavaScr...
Gulp
specifi...
ogc
1 commit
# 139,035
GraphQL
Gulp
vector-...
TypeScr...
1 commit
# 644,803
Python
JavaScr...
Gulp
1 commit
# 52,023
Gulp
Swift
Shell
Markdow...
1 commit
# 188,410
Python
JavaScr...
Google
tensorl...
1 commit

gulp-image GitHub Actions Status

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

gulp-image result

Install

$ npm install --save-dev gulp-image

External Dendencies

  • brew install libjpeg libpng
    on macOS
  • apt-get install -y libjpeg libpng
    on Ubuntu
  • npm install -g windows-build-tools
    on Windows

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', () => {
  gulp.src('./fixtures/*')
    .pipe(image({
      pngquant: true,
      optipng: false,
      zopflipng: true,
      jpegRecompress: false,
      mozjpeg: true,
      gifsicle: true,
      svgo: true,
      concurrent: 10,
      quiet: true // defaults to false
    }))
    .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 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', () => {
  gulp.src('./fixtures/*')
    .pipe(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'],
      gifsicle: ['--optimize'],
      svgo: ['--enable', 'cleanupIDs', '--disable', 'convertColors']
    }))
    .pipe(gulp.dest('./dest'));
});

License

MIT © Shogo Sensui

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.