Available in the LEADTOOLS Imaging toolkit.
SwapColors example for Visual Basic
LEAD1.SwapColors SWAP_RG