dominant-color

Gets the dominant color of an image.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
dominant-color
0.0.18 years ago8 years agoMinified + gzip package size for dominant-color in KB

Readme

dominant-color
Build Status
Gets dominant colour of an image. ~10 times faster than color-thief because it uses plain old imagemagick instead of canvas.

installation

npm install dominant-color

example

var color   = require('dominant-color'),
    imgPath = './path/to/your/image.jpg'

color(imgPath, function(err, color){
  // hex color by default
  console.log(color) // '5b6c6e'
})

color(imgPath, {format: 'rgb'}, function(err, color){
  console.log(color) // ['91', '108', '110']
})

Options:
  • format - 'hex' or 'rgb', defaults to 'hex'

alternatives

license

ISC