4 ms·
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 so
by ronaldx 13y ago
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.
- trumbitta2 13y agoOut of curiosity, could this work in node.js to avoid the server VS client thing?
- zabraxias 13y agoThere 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.
- ronaldx 13y agoYes, I agree there are potential sensible uses for this, but I hope that the given demonstration won't be taken as a sensible use. I think we are in violent agreement ;)
- zabraxias 13y agoFair 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.
- sbochins 13y agoA 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.