Firstly, I like it.
It's an elegant solution that gives excellent results and works as it says.
Secondly, I don't like it.
In the general case, this is not something that should be left to the client to calculate - whenever you are serving the image, the server ought to know what the dominant colour is. Why make the client calculate this every time the image is displayed?
This is a case where JavaScript harms the user: a JavaScript/jQuery solution to this has significant potential problems: there are numerous cases where it will break, some of which are identified in the other comments.
There are other use cases like suggesting a color palette based on an image upload before it ever gets sent to the server. Something like an admin interface for creating news article pages/blogs that orient around a particular theme.
I agree with the server handling of this if the server is providing the image but I could imagine HTML5 web apps making use of color analysis before the image ever gets sent to the server. JS isn't going away regardless of how much we close our eyes and pretend it's not there.
Fair enough but it's trickier to demo something that requires more elaborate user action. My reach-bag scenario wasn't so contrived actually we had to develop something that would guess a color palette based on a user uploaded picture at Mozilla.
The end product was never realized in that form but our solution included using a 2d canvas also and doing a count of color segments.
I think this script depends on the DOM, so you'd have to do jsdom or some other shenanagains to use it directly. However, the general idea should work just fine in node.js.
A lot of these client side solutions make it easier to build quick and dirty websites. I have several ideas for how this plugin could be pretty useful on some throwaway sites.
Secondly, I don't like it. In the general case, this is not something that should be left to the client to calculate - whenever you are serving the image, the server ought to know what the dominant colour is. Why make the client calculate this every time the image is displayed?
This is a case where JavaScript harms the user: a JavaScript/jQuery solution to this has significant potential problems: there are numerous cases where it will break, some of which are identified in the other comments.