You can let ImageMagick do this for you. Let make a red-black gradient image as follows:
convert -size 256x100 gradient:red-black in.png

Now we can load it, separate the channels R, G and B, change Red with blue and recompile them into the output image:
convert in.png -separate -swap 0,2 -combine out.png

ImageMagick is installed on most Linux distributions and is available for OSX (ideally via homebrew ), as well as for Windows from here .
If you want to make a whole directory of PNG files, for example, you would do
find . -iname "*.png" -exec convert "{}" -separate -swap 0,2 -combine {} \;
if you are on Linux or OS X.
If you are on Windows, you will need to do something similar with Mad Windows syntax:
FOR %%F in (*.PNG) DO convert "%%F" -separate -swap 0,2 -combine "%%F
source share