RGBQUAD *Palette = FreeImage_GetPalette(hDIB8bpp);
for (int i = 0; i < 256; i++)
{
Transparency[i] = 0xFF;
if (Palette[i].rgbRed != 0x00 && Palette[i].rgbBlue != 0xFF && Palette[i].rgbGreen > 0x00)
{
Transparency[i] = 0x00;
}
}
FreeImage_SetTransparencyTable(hDIB8bpp, Transparency, 256);
// FreeImage_Save(FIF_PNG, hDIB8bpp, "out.png");
FreeImage_Unload(hDIB24bpp);
return hDIB8bpp;
}
原图:
结果: