npm's personal messenger

    thumbs

    0.1.1 • Public • Published

    thumbs

    Transform stream which reads files, creates thumbnails of them, and writes their filenames.

    build status dependency status dev dependency status

    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 to height if undefined
    • height - pixel height of the thumbnail or relative to width if undefined
    • max - pixel width or height of the thumbnail depending on which dimension is largest
    • quality - compression quality of the thumbnail (from 0 to 100)

    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

    Keywords

    none

    Install

    npm i thumbs

    DownloadsWeekly Downloads

    11

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • uggedal