Algorithm for Color Balancing an Image I'm working on color-balancing images with as little input from the user of my app as possible, specifically to remove color casts caused by scanning aged paper. Photoshop's Auto Color action works great, with no input at all, but I don't even know where to begin in implementing something like that.

Where can I find an example of how to do that? I've done extensive searching and haven't found a good example. To see the correction I'm talking about, take a look at this question on Stack Overflow.
Photoshop's Auto Color is nothing more than Histogram Equalization.  

It has some improvements over the classic Histogram Equalization by adding a threshold of not touching the % at the extreme values.

Try it and see for yourself:  


Histogram Equalization.  
Histogram Equalization (Image Processing) Part 1.
Histogram.


Good Luck.