Use Gulp-imagemin with imagemin-jpeg-recompress plugin?

skube

I'm just experimenting with Gulp to simply optimize images. I find that imagemin-jpeg-recompress reduces JPGs more than the default optimizer that comes with gulp-imagemin. I'm wondering if there is a way to use gulp-imagemin but swap out the jpegtran plugin for the the imagemin-jpeg-recompress.

I can't seem to find any detailed docs as to how this might work together.

skube

I'm going to answer my own question. I could be wrong but it seems it's an easy process. Simply require the plugin (in this case, I want to use imagemin-jpeg-recompress plugin). Then specify the plugin to use within imagemin via the use property of imagemin. I believe this will override the bundled jpegtran optimizer that comes with imagemin.

var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var imageminJpegRecompress = require('imagemin-jpeg-recompress');

gulp.task('optimize', function () {
  return gulp.src('src/images/*')
    .pipe(imagemin({
      use:[imageminJpegRecompress({
        loops:4,
        min: 50,
        max: 95,
        quality:'high' 
      })]
    }))
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Use Gulp-imagemin with imagemin-jpeg-recompress plugin?

From Dev

How can I use gulp-imagemin to replace the original file

From Dev

gulp imagemin breaking SVG mask

From Dev

EACCES Error with Gulp-Imagemin

From Dev

EACCES Error with Gulp-Imagemin

From Dev

Gulp imagemin dest.on is not a function error

From Dev

Replace files in sub folders with gulp / imagemin

From Dev

Grunt newer:imagemin always runs imagemin:dynamic

From Dev

Grunt.js and imagemin - No "imagemin" targets found

From Dev

Grunt imagemin for multiple locations

From Dev

Grunt Imagemin not optimizing images

From Dev

Imagemin svgo delete path

From Dev

Installing gulp-imagemin on Windows creates well over 10,000 files

From Dev

ember-cli-imagemin lossyPNG ImageMin.pngquant is not a function

From Dev

Node.js imagemin on CentOS

From Dev

imagemin:dist task throwing error

From Dev

Yeoman: Cannot find 'imagemin-jpegtran'

From Dev

Using imagemin to compress images and store in mongodb

From Dev

Imagemin not enough for google page speed insights?

From Dev

How to use a gulp plugin inside a gulp plugin?

From Dev

jpegrecompress worker: `jpeg-recompress` not found;

From Dev

How to exclude a directory from grunt-contrib-imagemin

From Dev

Grunt build fail due to imagemin issue, what is wrong?

From Dev

imagemin for gruntjs used with watch for grunt not properly watching my files

From Dev

Getting error when running grunt-contrib-imagemin

From Dev

Npm module "grunt-contrib-imagemin" not found, Is it installed?

From Dev

grunt-contrib-imagemin - Take images of two different folders

From Dev

Npm module "grunt-contrib-imagemin" not found, Is it installed?

From Dev

grunt-contrib-imagemin outputting files to the wrong folder

Related Related

  1. 1

    Use Gulp-imagemin with imagemin-jpeg-recompress plugin?

  2. 2

    How can I use gulp-imagemin to replace the original file

  3. 3

    gulp imagemin breaking SVG mask

  4. 4

    EACCES Error with Gulp-Imagemin

  5. 5

    EACCES Error with Gulp-Imagemin

  6. 6

    Gulp imagemin dest.on is not a function error

  7. 7

    Replace files in sub folders with gulp / imagemin

  8. 8

    Grunt newer:imagemin always runs imagemin:dynamic

  9. 9

    Grunt.js and imagemin - No "imagemin" targets found

  10. 10

    Grunt imagemin for multiple locations

  11. 11

    Grunt Imagemin not optimizing images

  12. 12

    Imagemin svgo delete path

  13. 13

    Installing gulp-imagemin on Windows creates well over 10,000 files

  14. 14

    ember-cli-imagemin lossyPNG ImageMin.pngquant is not a function

  15. 15

    Node.js imagemin on CentOS

  16. 16

    imagemin:dist task throwing error

  17. 17

    Yeoman: Cannot find 'imagemin-jpegtran'

  18. 18

    Using imagemin to compress images and store in mongodb

  19. 19

    Imagemin not enough for google page speed insights?

  20. 20

    How to use a gulp plugin inside a gulp plugin?

  21. 21

    jpegrecompress worker: `jpeg-recompress` not found;

  22. 22

    How to exclude a directory from grunt-contrib-imagemin

  23. 23

    Grunt build fail due to imagemin issue, what is wrong?

  24. 24

    imagemin for gruntjs used with watch for grunt not properly watching my files

  25. 25

    Getting error when running grunt-contrib-imagemin

  26. 26

    Npm module "grunt-contrib-imagemin" not found, Is it installed?

  27. 27

    grunt-contrib-imagemin - Take images of two different folders

  28. 28

    Npm module "grunt-contrib-imagemin" not found, Is it installed?

  29. 29

    grunt-contrib-imagemin outputting files to the wrong folder

HotTag

Archive