Chrome Extension

Compress images using Gulp

//Installation - npm install --save-dev gulp-imagemin
const gulp = require('gulp');
const imagemin = require('gulp-imagemin');
 
gulp.task('compress_img', function() {
    return gulp.src('src/images/*')
            .pipe(imagemin())
            .pipe(gulp.dest('dist/images'))
})
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now

To compress images using gulp you can use gulp-imagemin npm package. The imagemin() function that is used to compress image will decrease the size of images.

NPM package installation

npm install --save-dev gulp-imagemin

You can also pass options that inside imagemin() function to make images compress as you want. The options can be:

imagemin({
    interlaced: true,
    progressive: true,
    optimizationLevel: 5,
    svgoPlugins: [
        {
            removeViewBox: true
        }
    ]
})
Was this helpful?
0 Comments
Open Code Manager We are hiring