JavaScript Image Manipulation Program adapted to Gulp
MIT License
JavaScript Image Manipulation Program (JIMP) adapted to Gulp
Manipulate your images directly from Gulp, without the need for any external dependency (i.e. external executables). OS independent.
$ npm install --save-dev gulp-jimp
var gulp = require('gulp');
var jimp = require('gulp-jimp');
gulp.task('default', function () {
return gulp.src('src/images/*')
.pipe(jimp({ resize: { width: 200, height: 300 }, scale: 30, greyscale: true }))
.pipe(gulp.dest('dist'));
});
Support all Jimp functionalities as of version 0.2.9.
You can define the transformations in the options, and add as many as you want (see example above).
{ resize: { width: 100, height: 100 } } // Very quick, unlike "crop"
{ crop: { x: 100, y: 100, width: 200, height: 200 } } // Very slow for some reason
{ invert: true } // Inverts the colours (very fast)
{ greyscale: true } // Turns into gray scale (very fast)
{ sepia: true } // Turns into sepia (very fast)
{ opacity: 0.5 } // Between 0 and 1, but doesn't seem to work
{ scale: 1.2 } // Will increase the image size by 20%
{ blur: 10 } // Value between 1 (slighly blured) and 100 (completely blured)
{ gaussian: 90 } // Min value: 1 (very very slow, even at 1, even slower when you go higher)
Thanks to Oliver Moran and his wonderful Jimp module
I'm planning to take a look at the original Jimp module, to see if I can make that use streams/buffers to avoid having to write a temporary file.