0.2.0 • Published 7 years ago
gulp-imgr v0.2.0
gulp-imgr
An image manipulation plugin for gulp. Resize, Optimise and save all your images with one simple plugin. This plugin is useful if your a developer that receives a ton of high-resolution/filesize images aswell as anything but jpg. This plugin completely removes the need for ever touching your images. gulp-imgr is a work in progress.
Features
- Highly Configurable
- Designed to output web friendly images
Getting Started
Install the gulp-imgr using NPM or your favourite node package manager
$ npm install gulp-imgrAdd gulp-imgr to your gulpfile
var gulpImgr = require('gulp-imgr');Create a gulp task to start processing images
gulp.task('images', function(done) {
  return gulp.src( imageFiles )
    .pipe(gulpImgr({
      maxWidth: 1000,
      maxHeight: 800,
      quality: 70,
      maxFilesize: 400,
      outputFormat: 'jpg',
      styles: {
        small: {
          maxWidth: 600,
          quality: 75
        }
      }
    }))
    .pipe(gulp.dest( './assets/img/' ))
});Configuration
| Option | Type | Default | Description | 
|---|---|---|---|
| maxWidth | int | 1000 | Set the maximum width the image can have. It'll be resized if its over | 
| quality | int | 70 | The compression quality of the outputted image | 
| format | string | jpg | Outputted image format | 
| styles | object | null | Contains additional image styles | 
| convertSvg | bool | true | Convert any SVGs to your specified format |