Available in the LEADTOOLS Imaging toolkit. |
InfoHasAlpha example for C++ 4.0 and later
m_LEAD1.Load("c:\\temp\\1.jpg", 24, 1, 1);//load a 24-bit image
m_LEAD2.SetBitmap(m_LEAD1.GetBitmap());
m_LEAD2.ColorRes(8, 0, 0, 0); //just make it 8-bit
//now set an alpha channel
m_LEAD1.SetBitmapAlpha(m_LEAD2.GetBitmap());
//save and free
m_LEAD1.Save("c:\\temp\\32.png", FILE_PNG, 32, 0, 0);
m_LEAD1.SetBitmap(0);
m_LEAD2.SetBitmap(0);
AfxMessageBox("Pause");
//re-load
m_LEAD1.GetFileInfo("c:\\temp\\32.png", 0, 0);
if(m_LEAD1.GetInfoHasAlpha())
m_LEAD1.Load("c:\\temp\\32.png", 0, 1, 1);
m_LEAD2.SetBitmap(m_LEAD1.GetBitmapAlpha());