For some bizarre reason I needed to transfer the histogram profile from one image to another image. Turning to Gimp, I decided to script it. I used script-fu, as I am still trying to learn python. The basic premise is to sample the histogram of both images, then convert them into an incremental function. Following that, you determine the transfer function to convert back from the one to the other. I realize that sounds complicated, but it isn't that bad. Here is a diagram:
So all I had to do was write a gimp script to do this. No Problem!