gulppngjpegimage-optimizationgulp-imagemin

What gulp-plugin can be used to convert jpg/png to progressive/interlaced?


I'm using gulp-imagemin, but i want to not only minify images, but make them progressive/interlaced. What tool can be used for this task?


Solution

  • I typed "gulp image progressive" into Google and gulp-image-optimization was the first result. Here's a direct copy/paste of the example on that page:

    var gulp = require('gulp');
    var imageop = require('gulp-image-optimization');
    
    gulp.task('images', function(cb) {
        gulp.src(['src/**/*.png','src/**/*.jpg','src/**/*.gif','src/**/*.jpeg']).pipe(imageop({
            optimizationLevel: 5,
            progressive: true,
            interlaced: true
        })).pipe(gulp.dest('public/images')).on('end', cb).on('error', cb);
    });