Get histograms from images using JavaScript