$ npm install gulp-images-resizer
let resizer = require('gulp-images-resizer');
gulp.task('resize', function() {
return gulp.src('src/**/*.*')
.pipe(resizer({
format: "png",
width: "50%"
}))
.pipe(gulp.dest('dest/'));
});
format
- fromat of output files (png, jpg, gif, bmp or *). Default: *width
- width of output images (fixed, percentage or -1 for auto). Default: -1height
- height of output images (fixed, percentage or -1 for auto). Default: -1noCrop
- disable the crop feature. If true it will choose the max size between height/width. Default: falsequality
- quality of output images (from 0 to 100). Default: 100tinify
- tinify images using TinyPNG. Default: falsetinifyKey
- TinyPNG key. Default: ""