News for hackers. Stuff that matters.
Re:Color Thief, script for grabbing the color palette from a... by GBKS on Saturday January 07, 2012 @01:16PM (#3437618)
I built a similar tool for this purpose recently. It uses Canvas, but falls back to Flash if Canvas is not supported. Here's an example - hover and click the image - http://www.imagecolorpalette.com/image/40
Re:Color Thief, script for grabbing the color palette from a... by DTrejo on Sunday January 08, 2012 @03:18AM (#3439160)
Made something similar a long time ago but never made it look as good as yours :)

http://colorslice.dtrejo.com/

Re:Color Thief, script for grabbing the color palette from a... by stylishgnome on Saturday January 07, 2012 @03:30PM (#3437996)
Why does it turn magenta when you double-click (on two distinct pixels specifically)?
Re:Color Thief, script for grabbing the color palette from a... by tikhonj on Saturday January 07, 2012 @03:36PM (#3438013)
That's just the highlight color. Assuming you're using Chrome, it's pretty eager about highlighting random stuff; other browsers may be similar. Try selecting some text.
Re:Color Thief, script for grabbing the color palette from a... by VMG on Saturday January 07, 2012 @03:57PM (#3438060)
There is a css rule to disable user selection which might be handy here: http://stackoverflow.com/questions/826782
Re:Color Thief, script for grabbing the color palette from a... by wtvanhest on Saturday January 07, 2012 @12:50PM (#3437536)
I'm not a programmer, but I see an opportunity here:

Go to istockphoto.com - this is a site where you can buy images for use in any type of publication, advertising etc.

The opportunity I see would be to offer to write software which indexes their entire collection by color.

Then when someone wants to buy an image for a publication they could put their colors in and have istockphoto only show them images which fit the color palette.

This would save designers a ton of time.

Re:Color Thief, script for grabbing the color palette from a... by joshuacc on Saturday January 07, 2012 @12:55PM (#3437553)
iStockPhoto already has a "search by color" feature which does pretty much what you're suggesting. http://screensnapr.com/v/gTjWCw.png
Re:Color Thief, script for grabbing the color palette from a... by wtvanhest on Saturday January 07, 2012 @12:57PM (#3437559)
sorry, that must be new then. It has been a little while since I logged in there.
Re:Color Thief, script for grabbing the color palette from a... by petercooper on Saturday January 07, 2012 @03:03PM (#3437935)
Sorry in advance as I'm not trying to make you feel stupid but.. I used to use that feature a lot before they were acquired by Getty (and their prices got so ridiculous I stopped using them.) So at least six years ago.
Re:Color Thief, script for grabbing the color palette from a... by AndyNemmity on Saturday January 07, 2012 @03:04PM (#3437938)
Wow, I can use this. This is great. I run an online football game http://deeproute.com and players upload helmets to go with their team.

I can use this to check that helmet image they are using, and grab the color palette and then use those colors to drive their color scheme.

Brilliant! Thanks!

Re:Color Thief, script for grabbing the color palette from a... by jakejake on Saturday January 07, 2012 @03:04PM (#3437936)
This could produce an interesting and possibly strange image viewer if you use it to control the color scheme of the page. For example, you upload an image and the css of the page itself updates to be complimentary to the photo.
Re:Color Thief, script for grabbing the color palette from a... by sparshgupta on Saturday January 07, 2012 @10:50AM (#3437220)
Very nice. I would expect a provision to upload (or add URL of) an image and test it on the demo page before downloading it and using it on my website.
Re:Color Thief, script for grabbing the color palette from a... by mark_story on Saturday January 07, 2012 @01:39PM (#3437686)
You can build a similar thing server side using Imagemagick. It has a great suite of tools for doing image quantization and other manipulations.
Re:Color Thief, script for grabbing the color palette from a... by chrisacky on Saturday January 07, 2012 @02:28PM (#3437843)
I've tried. I've failed. I would have loved seeing this been done in Imagick on PHP.
Re:Color Thief, script for grabbing the color palette from a... by sorghum on Saturday January 07, 2012 @04:54PM (#3438165)
You can do it like this with ImageMagick on the command line. This will quantize the image to 8 colors and list them in descending order of occurance:

  convert image.jpg -resize 400x400 -format %c -dither None -quantize LAB -colors 8 -depth 8 histogram:info:- | sort -r
Re:Color Thief, script for grabbing the color palette from a... by ciupicri on Sunday January 08, 2012 @12:09AM (#3438943)
Sorting should be done with sort -r -n -t :
Re:Color Thief, script for grabbing the color palette from a... by brador on Saturday January 07, 2012 @01:07PM (#3437595)
Could you make it show the RGB of the color of the square color block I'm hovering over in the palette area?
Re:Color Thief, script for grabbing the color palette from a... by Dylanfm on Saturday January 07, 2012 @06:08PM (#3438321)
Clusterfck is a nice JS library for hierarchical clustering: http://harthur.github.com/clusterfck/

I put together a tiny tool like the posted link for playing with clusterfck:

http://dylanfm.github.com/Ladderfck/

Kind of handy for getting a feel for what you can do - e.g. trying different distance metrics and linkages. It too uses canvas.

Re:Color Thief, script for grabbing the color palette from a... by axx on Saturday January 07, 2012 @02:19PM (#3437810)
Can someone please write this in ruby? :)
Re:Color Thief, script for grabbing the color palette from a... by quan on Saturday January 07, 2012 @03:09PM (#3437946)
I made a gem to do exactly this with RMagick, you can check it out here: https://github.com/mquan/prizm
Re:Color Thief, script for grabbing the color palette from a... by sorghum on Saturday January 07, 2012 @04:42PM (#3438147)
Here's my shot at it from a few months ago: http://github.com/quadule/colorscore

ImageMagick does the actual color extraction, then I wrote some code to score those colors against a palette for use in a "search by color" system.

Re:Color Thief, script for grabbing the color palette from a... by hns_bollocks on Saturday January 07, 2012 @02:26PM (#3437836)
no, now go jump into a lake

and take your hipster language with you

Re:Color Thief, script for grabbing the color palette from a... by vertr on Saturday January 07, 2012 @02:48PM (#3437893)
Hacker News has standards of discussion. Learn them.
Re:Color Thief, script for grabbing the color palette from a... by drpancake on Saturday January 07, 2012 @01:53PM (#3437731)
Clever use of <canvas>. I made an Android app that does something similar:

https://market.android.com/details?id=uk.co.opeso.android.co...

Re:Color Thief, script for grabbing the color palette from a... by Mavyrk on Saturday January 07, 2012 @03:12PM (#3437956)
It would be interesting to see if you could use a system like this to automagically derive background colors for image display, picking muted complimentary colors to make the dominant color in an image "pop", so to speak.
Re:Color Thief, script for grabbing the color palette from a... by aaronblohowiak on Saturday January 07, 2012 @03:15PM (#3437963)
You can do this by representing the colors into HSV and then modifying the hue by 180%, desaturating them and then adjusting the brightness (v). Most color libraries will let you deal in RGB(A) or HSV so this is pretty straightforward to DIY.
Re:Color Thief, script for grabbing the color palette from a... by daltonlp on Saturday January 07, 2012 @07:31PM (#3438504)
That is rather nice! http://www.colr.org has something similar, but it relies on server-side code. An all-javascript solution is a cool thing.
Re:Color Thief, script for grabbing the color palette from a... by callmeed on Saturday January 07, 2012 @02:39PM (#3437874)
FYI Mobile Safari on iPhone 4 and iPad 1 crashes every time for me.
Re:Color Thief, script for grabbing the color palette from a... by kalleboo on Sunday January 08, 2012 @05:25PM (#3440715)
Have you reported it to Apple?
Re:Color Thief, script for grabbing the color palette from a... by simplify on Saturday January 07, 2012 @07:57PM (#3438537)
http://colorapi.com/ is similar but better suited for finding color theme inspiration.
Re:Color Thief, script for grabbing the color palette from a... by andrewcooke on Saturday January 07, 2012 @12:38PM (#3437499)
what does it mean when the colours get bigger as i mouse over them? is something else meant to happen? i guess that should mean they are clickable, or that something else is changing, but i don't see anything else change and nothing happens when i click. is something broken (chrome latest stable, linux)?

[edit: and if not, please don't do that.]

Re:Color Thief, script for grabbing the color palette from a... by tayeed on Saturday January 07, 2012 @01:10PM (#3437600)
I think if the users can copy the Hex codes by clicking on individual colors, it can be a useful service.
Re:Color Thief, script for grabbing the color palette from a... by g3orge on Saturday January 07, 2012 @01:04PM (#3437579)
I always wanted something like this and I even thought of building it, but I didn't have time to learn javascript.
Re:Color Thief, script for grabbing the color palette from a... by mikeleeorg on Saturday January 07, 2012 @12:53PM (#3437544)
This kind of reminds me of http://www.pictaculous.com/
Re:Color Thief, script for grabbing the color palette from a... by manojlds on Saturday January 07, 2012 @11:27PM (#3438887)
Is white not considered for dominant colour? In the apple logo pic, white is clearly the dominant...
Re:Color Thief, script for grabbing the color palette from a... by baddox on Sunday January 08, 2012 @12:54AM (#3438997)
Re:Color Thief, script for grabbing the color palette from a... by alexkearns on Saturday January 07, 2012 @12:15PM (#3437430)
I wonder if it works with cross-domain images. I could not see in the documentation if it does.
Re:Color Thief, script for grabbing the color palette from a... by joshfraser on Saturday January 07, 2012 @02:24PM (#3437829)
I haven't tested it, but I would expect so. There aren't many cross-domain restrictions in browsers for images.
Re:Color Thief, script for grabbing the color palette from a... by jQueryIsAwesome on Saturday January 07, 2012 @02:53PM (#3437906)
Yes, there are. That is why this thing exist: http://www.maxnov.com/getimagedata/

So probably it doesn't work for cross-domain images.

Re:Color Thief, script for grabbing the color palette from a... by mnemosyne51 on Saturday January 07, 2012 @07:22PM (#3438484)
Adobe Kuler also has this feature.