gulp-imagemin poor compression rate

1.3k Views Asked by At

I've run the images on my site through gulp-imagemin in order to compress them and decrease its size. I've used several plugins available with gulp-imagemin. The definition of my 'compress' task below:

gulp.task('compress', function () {
    return gulp.src('themes/rubbish_taxi/images/*')
        .pipe(imagemin({
            progressive: true,
            optimizationLevel: 7,
            svgoPlugins: [{removeViewBox: false}],
            use: [pngquant(), jpegtran(), optipng(), gifsicle()]
        }))
        .pipe(gulp.dest('themes/rubbish_taxi/images/dist'));
});

Unfortunately, gulp-imagemin seems to perform very poorly on compressing *.jpg images. I've managed to save 10kb on .jpg files that weighed ~300kb before I run the compression task. This was regardless of the optimizationLevel being set to 7 (the highest value).

When I saved the same image as 'optimized for web' in GIMP, its size was reduced by ~50%.

Why is gulp-imagemin so ineffective, and how I can effectively compress my images in bulk?

1

There are 1 best solutions below

1
On

How about using imagemin-jpeg-recompress?