Skip to content

shime/dominant-color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dominant-color

Build Status

Gets dominant color 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

MIT

About

Gets dominant color of an image.

Resources

License

Stars

Watchers

Forks

Packages

No packages published