Javascript histogram equalisation.