Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    pixel-averagepublic

    pixel-average

    Average red, green, blue, alpha & brightness of an image

    • Javascript only (no worries about bindings)
    • Accepts PNG, JPG or BMP from Buffer, Path or URL

    Install

    $ npm install --save pixel-average
    

    Usage

    const pixelAverage = require('pixel-average')
    const source = './img.jpg'
     
    // source accepts any format Jimp reads (BMP, JPG, PNG): 
    //   String: URL or Path to image 
    //   Buffer 
    pixelAverage(source, function (err, averages) {
      console.log(`
        red: ${averages.red}
        green: ${averages.green}
        blue: ${averages.blue}
        alpha: ${averages.alpha}
        brightness: ${averages.brightness}
      `)
    })

    API

    pixelAverage(source: buffer(png/jpg/bmp)/string(url)/string(path), callback: function)

    Related

    • Jimp - image processing library for Node written entirely in JavaScript

    Licence

    MIT © Ben Evans

    install

    npm i pixel-average

    Downloadslast 7 days

    4

    version

    1.0.1

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar