Lokesh Dhakar 42f0c4f779 readme
2011-11-03 17:55:44 -04:00
2011-11-03 17:54:22 -04:00
2011-11-03 17:54:22 -04:00
2011-11-03 17:54:22 -04:00
2011-11-03 17:54:22 -04:00
2011-11-03 01:03:18 -04:00
2011-11-03 17:54:22 -04:00
2011-11-03 17:55:44 -04:00

Color Thief

by Lokesh Dhakar - Blog - Twitter

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

Demo

###Requirements

  • jQuery
  • quantize.js

###Usage

####getDominantColor(sourceImage) returns {r: num, g: num, b: num}

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

####createPalette(sourceImage, colorCount) returns array[ {r: num, g: num, b: num}, {r: num, g: num, b: num}, ...]

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

BUGGY: Function does not always return the requested amount of colors. It can be +/- 2.

Licensed under the Creative Commons Attribution 2.5 License

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%