How to create a RGB plot from three different TIF files?

could you please point me out to the source code for the function that applies the stretching? It looks to do a better job than the ones defined here Any chance to have it in pure images package?