Lokesh Dhakar 0043a335d8 .
2012-04-23 17:36:38 -04:00
.
2012-04-23 17:36:38 -04:00
2011-11-03 20:40:46 -04:00
.
2012-04-23 17:36:38 -04:00
.
2012-04-23 17:36:38 -04:00
.
2012-04-23 17:36:38 -04:00
.
2012-04-23 17:36:38 -04:00

#Color Thief

A script for grabbing the dominant color or color palette from an image. Uses javascript and canvas.

See a Demo | Read more on my blog

##Usage

###Get Dominant Color

getDominantColor(sourceImage)
returns [num, num, num]

Uses the median cut algorithm provided by quantize.js to cluster similar colors and return the base color from the largest cluster.

###Create Palette

createPalette(sourceImage, colorCount)
returns [ [num, num, num], [num, num, num], ... ]

Use the median cut algorithm provided by quantize.js to cluster similar colors.

##License by Lokesh Dhakar | lokeshdhakar.com | twitter.com/lokeshdhakar

Thanks to jfsiii for a large number of code improvements and others for submitting issues and fixes.

Licensed under the Creative Commons Attribution 2.5 License

  • Free for use in both personal and commercial projects.
  • Attribution requires leaving author name, author homepage link, and the license info intact.
Description
Extract colors from an image in Node.js and browser. Mirror of my fork from https://github.com/janishutz/color-thief
Readme MIT 2.1 MiB
Languages
TypeScript 43.1%
JavaScript 36.2%
HTML 16.6%
CSS 4.1%