Ha!! I win!!! At least for creatures. That took a LOT more in depth experimenting with the game, screen shots and image editing programs than I would have liked. I thought I was going to go nuts for a bit trying to figure this one out.
Part of my problem was that I had hard coded the color values in the program based on DF's default colors. But I'm testing with IronHand's graphic set, which uses different colors by default. I kept seeing different colors in game than what I was getting from the program. Once I realized that I had it read colors.txt and use the actual colors that the game was using and everything started working perfectly.
If anyone is curious, this is the actual drawing procedure I'm using now.
1. draw the background color
2. per pixel: get an average value from the R, G and B channels.
3. calculate a scaler by dividing that value by 255
4. set each of the R, B and B values of that pixel to the forecolor value channel times the scaler calculated in the previous step.