small utility to perform binning of RGB data