Socket
Socket
Sign inDemoInstall

dominant-color

Package Overview
Dependencies
2
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dominant-color

Gets the dominant color of an image.


Version published
Maintainers
1
Install size
1.15 MB
Created

Readme

Source

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

Keywords

FAQs

Last updated on 17 Oct 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc