A script for grabbing the color palette from an image. Uses Javascript and the Jimp to make it happen. This fork does NOT use canvas, and is can only used with NodeJs.
Install the module via npm
npm install color-thief-jimp --save
And use it:
var ColorThief = require('color-thief-jimp');
var ColorThief = require('color-thief-jimp');
// getColor(sourceImage[, quality])
var dominantColor = ColorThief.getColor(sourceImage);
// dominantColor = [intRed, intGreen, intBlue]
In this example, we build an 8 color palette.
var ColorThief = require('color-thief-jimp');
// getPalette(sourceImage[, colorCount, quality])
var palette = ColorThief.getPalette(sourceImage, 8);
// palette = [ [intRed, intGreen, intBlue], [intRed, intGreen, intBlue], ... ]
First release.
Source code based on color-thief (MIT license) by Lokesh Dhakar lokeshdhakar.com