Interesting snippet from freeimage :
PluginICO.cpp from FreeImage probably has all you need to understand how all the icon headers work etc.
if(FreeImage_IsTransparent(dib)) { if(bit_count == 32) { // create the AND mask from the alpha channel int width_and = WidthBytes(width); BYTE *and_bits = and_mask; // clear the mask memset(and_mask, 0, size_and); for(int y = 0; y < height; y++) { RGBQUAD *bits = (RGBQUAD*)FreeImage_GetScanLine(dib, y); for(int x = 0; x < width; x++) { if(bits[x].rgbReserved != 0xFF) { // set any transparent color to full transparency and_bits[x >> 3] |= (0x80 >> (x & 0x7)); } } and_bits += width_and; } }
PluginICO.cpp from FreeImage probably has all you need to understand how all the icon headers work etc.