tags:

views:

373

answers:

1

I want to extract images from a CImageList and save them as transparent GIF files. I'm using the following GDI+ code and the transparent area comes out black.

const HICON hIcon = myImageList.ExtractIcon( nImage );    
Bitmap* gdiBMP = Bitmap::FromHICON( hIcon );    
CLSID   encoderClsid;    
GetEncoderClsid( T2W( "image/gif" ), &encoderClsid );    
Status stat = gdiBMP->Save( L"myfilename.gif", &encoderClsid, NULL );    
delete gdiBMP;

I'm assuming I need to explicitly set the transparent image in the gif file. Or muck with the Bitmap. I have found some .Net articles related to this, but for this specific project I'm using VC6.

Have Google'd to no avail. Any/all suggestions most welcome.

Neville Franks, www.surfulater.com

+1  A: 

It seems this is not as easy as picking a transparent color. I found a tutorial for this here. It's for C#, but I guess it can be ported easily.

schnaader