Licence
MIT
Version
0.1.1
Deps
2
Vulns
1
Weekly
0
thumbs
Transform stream which reads files, creates thumbnails of them, and writes their filenames.
Example
var thumbs = require('thumbs');
var thumbnails = thumbs({
small: {height: 256*2, quality: 25},
large: {max: 1024*2, quality: 50},
huge: {max: 1024*8, quality: 50}
});
thumbnails.write({
src: 'test/img/hasselblad.jpg',
dest: 'hasselblad.jpg'
});
thumbnails.on('data', function(obj) {
console.log('thumbnailed:', obj);
});
Methods
var thumbs = require('thumbs')(formats);
Return a transform stream which reads {src: '', dest: ''} objects and writes
{src: '', dest: ''} objects based on the given formats.
formats is an object where each key is used in the written dest name
and each value can use the following opts:
width- pixel width of the thumbnail or relative toheightif undefinedheight- pixel height of the thumbnail or relative towidthif undefinedmax- pixel width or height of the thumbnail depending on which dimension is largestquality- compression quality of the thumbnail (from0to100)
Installation
Install imagemagick with your platform's native package manager:
apt-get install imagemagick
brew install imagemagick
pacman -S imagemagick
Install the NPM module:
npm install thumbs
License
MIT