Look at rnc-color-stretch for color image processing
It has been suggested that we take a look at rnc-color-stretch to process color images.
It's open source but in a scripting language provided by another image processing software, current version's code is there.