I'm looking for a way to scan any given image and determine if it is mostly dark or light (in a sense of bright vivid colours or dark and desaturated colours).
This is done in PHP: Background image dark or light?
But is there a way to do it on the fly with Javascript? To look over the pixels and determine their RGBs? I need to know simply whether to style the overlaying text black or white respectively.