philmoz is talking about changing one of the files in the CHDK source code and compiling a special version of CHDK. Its not really something you can do by tweaking an image. If you are not able to build your own version of CHDK (and don't want to learn), he volunteered to build one for you.
Actually that direction was in response to reyalp:
You could hack the CFAPattern tag in the DNG to swap which pixels are interpreted as R and B. Not sure if this is what you want, but it should be straightforward to do either in camera or after the fact.
there Is an exif tag called Exif.Image.CFAPattern and I believe his suggestion was to modify that entry to reverse the red and blue pixels. I would really like to see if I could that to somehow work in a batch file so I could run the thousands of previous DNG files through it and fix them all. but when I looked at any of my DNG files with exiv2, that entry is just not there. I'm not sure if it's really included in the file and I just can't find it or if the DNG files I created with dng4ps2 already processed the bayer data and so that was not needed anymore.
philmoz did compile a version with his recommended change in it, (thank you very much philmoz!) and I'm getting ready to go outside and take some test shots.. as soon as my batteries finish charging. I'll report back on that.
The attached lua script can be used with chdkptp to change the cfa tag on existing DNG files.
Thanks for this lua file reyalp, I'll give it a try! If I can get it to work, perhaps I can use it to convert my previous photos as well somehow.
For this camera, it would be great if it just always made DNG files with the red and blue reversed, as the DNG is created, because it always needs to be done, and since it's a converted camera, it's only function is to take infrared photos. but I would also really think it would be great to convert other dng files as I have a converted sony camera as well, and there are a lot of people taking infrared photos with other non-canon cameras and none of them (at least in the groups I am involved in) know how to achieve the red-blue swap and still keep their raw data, and since the people involved with chdk are quite a bit more knowledgeable about programming and also the details of the DNG file structure (which baffles me) I'm hoping to come up with a solution that could help the entire infrared community to keep their RAW files and have the red/blue swap.
What would be great is if I could somehow come up with a program that I can run in a DOS batch file that works just like your hackcfa program... just read in DNG's and write out converted DNG's Perhaps I can use the information in hackcfa to learn more about how DNG files work and how to make that happen. I'll report back on how hackcfa works as well