#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.