pixel-average
v1.0.1
Published
Average red, green, blue, alpha & brightness of an image
Downloads
6
Readme
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