Questions tagged [gulp-imagemin]

gulp-imagemin is a gulp plugin for minification of SVG, PNG, JPEG and GIF images.

gulp-imagemin is a gulp plugin for minification of SVG, PNG, JPEG and GIF images.

Example of usage:

var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');

gulp.task('default', function () {
  return gulp.src('src/images/*')
    .pipe(imagemin({
      progressive: true,
      svgoPlugins: [{removeViewBox: false}],
      use: [pngquant()]
    }))
    .pipe(gulp.dest('dist'));
});
76 questions
10
votes
2 answers

Why don't newly added files trigger my gulp-watch task?

I have a gulp task which uses gulp-imagemin to compress images. When I add new files to this directory I'd like for this task to compress them as well. I read that gulp.watch doesn't trigger on new files and that I should try gulp-watch so I used it…
Jesse Hattabaugh
  • 7,876
  • 8
  • 34
  • 38
8
votes
1 answer

How do I get the best PNG compression with gulp-imagemin + plugins?

I am trying to get the best setup possible for compressing pngs. I have found there are some plugins available here for imagemin: https://www.npmjs.com/browse/keyword/imageminplugin I have tried all the PNG options but the compression rates appear…
joep
  • 258
  • 3
  • 11
7
votes
1 answer

Got ENOENT error with gulp-image

It seems there's an error with image optimizer libraries. The same error happens on gulp-image-min and some other gulp plugins. Anyone can help? My gulp task: var image = require('gulp-image'); gulp.task('images', function () { return…
Saeed Seyfi
  • 637
  • 5
  • 18
7
votes
1 answer

Gulp Imagemin not finishing

This is my Gulp task: //Image Optimization gulp.task( 'imagemin', function () { return gulp.src( imageDir + '**/*.{png,jpg,JPG,svg}' ) .pipe( imagemin( { progressive: true, use: [ …
Marten Zander
  • 2,385
  • 3
  • 17
  • 32
7
votes
3 answers

Gulp giving error on symlinks in gulp.src()

I have a symlink in my images folder that points to another folder containing external images provided by a third party library (managed by bower - gotta love javascript). As part of my build process, I compress all images as…
rstuart85
  • 2,035
  • 2
  • 15
  • 19
6
votes
2 answers

Improve PNG optimization Gulp task

This is source PNG with transparency: https://i.stack.imgur.com/6XZBB.png (13.3kB) optimized using compresspng.com: https://i.stack.imgur.com/Ts1cM.png (5.4kB) optimized using tinypng.com: https://i.stack.imgur.com/ZcclS.png (5.6kB) optimized…
Limon Monte
  • 52,539
  • 45
  • 182
  • 213
5
votes
0 answers

Gulp Imagemin "MaxBufferError: stdout maxBuffer exceeded" when I try to minify large amount of files

Gulp Imagemin errors MaxBufferError: stdout maxBuffer exceeded when I try to minify a large amount of files (230). It will run the task if I minify 40-50 files at a time. How do Increase the buffer? Or stop the task discontinuing? node version…
MrThunder
  • 725
  • 12
  • 21
4
votes
2 answers

How can I run a gulp imagemin task only on new and changed files?

I tried to add a gulp task like below and run gulp images so that it only runs only on added/changed files However, that seems to not work...Any idea? gulp.task('images', function (event) { switch (event.type) { case 'added': case…
Hello Universe
  • 3,248
  • 7
  • 50
  • 86
3
votes
1 answer

Gulp optimize images with imagemin

I'm trying to Gulp optimize my images with imagemin https://www.npmjs.com/package/gulp-image-optimization I have problem to find a good documentation which can show me exact parameters and different option. For now there is not a lot of gain in my…
Kevin
  • 4,823
  • 6
  • 36
  • 70
3
votes
2 answers

gulp-imagemin: Couldn't load default plugin xxx

the env: windows 7 node 6.9.5 I use the plugin like this npm. but I get an error. from some video, It's correct. It's relative to imagemin's version? // gulpfile.js var gulp = require('gulp'); var imagemin = require('gulp-imagemin'); var app =…
yuwanlin
  • 65
  • 1
  • 1
  • 10
3
votes
1 answer

Gulp imagemin optimization removes svg symbol

This is the first time I use Gulp task-runner or any kind of task-runner. I hope I state my problem in an understandable way. I have an svg file named svg-system.svg which contains: