sorting colors (MacRuby Graphics)
I wrote a new sample for MacRuby Graphics that samples the colors from a jpg and display them. I was trying to find a good way to sort the colors in a way that makes total sense (sort by color family and by brightness). Unfortunately, this isn't an easy thing to do, here is the result: http://img.skitch.com/20100716-nth8dcm4ag12bcns1fgngt4ird.png Source code: http://github.com/mattetti/macruby_graphics/blob/master/examples/color_sampl... I'd be curious to know if one of you knows a better way to do that? Thanks, - Matt
On Jul 15, 2010, at 23:10 , Matt Aimonetti wrote:
I wrote a new sample for MacRuby Graphics that samples the colors from a jpg and display them. I was trying to find a good way to sort the colors in a way that makes total sense (sort by color family and by brightness). Unfortunately, this isn't an easy thing to do, here is the result:
http://img.skitch.com/20100716-nth8dcm4ag12bcns1fgngt4ird.png Source code: http://github.com/mattetti/macruby_graphics/blob/master/examples/color_sampl...
I'd be curious to know if one of you knows a better way to do that?
IIRC, you usually convert from rgp to hsv and sort on [h, s, v] or [h, v, s]. I can't tell from your code sample what the sort is doing.
participants (2)
-
Matt Aimonetti
-
Ryan Davis