Available in the LEADTOOLS Imaging toolkit.
AutoTrim example for C++ 4.0 and later
This example trims the bitmap with threshold of 10.
m_Lead1.AutoTrim(10); m_Lead1.ForceRepaint();