How to get the dominant color or color palette from an image in JavaScript

Try the Color Thief which created by Lokesh Dhakar. It extracts color palette using MMCQ(modified median cut quantization) algorithm.

myImage = $('#myImage');
dominantColor = getDominantColor(myImage);
paletteArray = createPalette(myImage, 10); // 2nd argument sets # of colors in palette


MIT License

HTML5 Canvas available environment.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.