4
$\begingroup$

I have a small project that needs to extract the perceptually-salient colors of an image, in javascript. There are a few libraries out there (color-thief.js, vibrant.js). The trouble is, I'm finding that adobe color's image extraction does a noticeably better job of recognizing the little high-contrast highlight colors which make a big visual aesthetic difference, even though they represent a small number of pixels. (This is the "color mood" option). For example, the color of lipstick a person wears, or small decorations on a big cake.

I think (?) Adobe doesn't provide an API for their Color CC any more, but in any case I'd rather not rely on it. Is there a javascript library out there with similar functionality that provides access to some sort of functionality that maximizes dissimilarity between hues?

$\endgroup$
2
  • $\begingroup$ Yes, algorithms are on topic, software programs aren't, and so I guess libraries are in-between? I was hoping for an answer along the lines of "Oh, you need the <maximal euclidian distance in XYZ colorspace> algorithm. There's an implementation in xyz.js; go an study it there." $\endgroup$
    – Escher
    Commented Nov 13, 2015 at 12:50
  • $\begingroup$ For your particular question, I suspect your main task will be choosing which colour space best suits your purpose, which should simplify the remainder of the task. $\endgroup$ Commented Nov 13, 2015 at 14:18

1 Answer 1

1
$\begingroup$

In the end I decided to use Leon Sorokin's RGBQuant.js for quantization, because it offered better flexibility over the color histogram/clustering method. I'm probably going to convert the quantized palette RGB output to HSV and implement custom clustering that picks out the "highlight" colors, favoring diversity of hue for colors with high value and saturation, and low occurrence frequency.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.