Available in the LEADTOOLS Imaging toolkit.
Grayscale example for C++ 4.0 and later
This example converts the bitmap to 12-bit grayscale.
m_Lead1.Grayscale(12); //grayscale to 12-bit