npm.io
0.2.2 • Published 7 years ago

gulp-tinyimage

Licence
ISC
Version
0.2.2
Deps
3
Size
6 kB
Vulns
3
Weekly
0

gulp-tinyimage

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-tinyimage is a work in progress and isn't complete.

Features

  • Highly Configurable
  • Designed to output web friendly images

Getting Started

Install the gulp-tinyimage using NPM or your favourite node package manager

$ npm install gulp-tinyimage

Add gulp-tinyimage to your gulpfile

var gulpTinyimage = require('gulp-tinyimage');

Create a gulp task to start processing images

gulp.task('images', function(done) {
  return gulp.src( imageFiles )
    .pipe(gulpTinyimage({
      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