Sort Photos by sample color


“iViewMedia Pro” is an application for organizing photos, letraset fonts, video, ect. (todays aquired from Microsoft and recalled in “Expression Media”), and i must say, this tool is very useful for me. The application has a very interesting function: to sort images by sample color. (predominant color)
Now, i’ve written a (matrix) applescript to collect these images (sample colors >the results have an limitless range of color values) into a limited number of folders (39) in the “Finder”:

-12 for the basis colors
-12 brighter basis colors
-12 darker basis colors
-3 for black, white, grey tones

But, unfortunately, “iViewMedia Pro” calculates not always acceptable sample color values. (unfortunately, this function doesn’t support any parameter to adjust another color sorting behaviour)
thus I thought to adapt this script for another application which is able to evaluate a more acceptable color value sorting; any suggestions ? (Photoshop, …?,…?) H like Help!