Welcome Guest. Please Login or Register. Apr 5th, 2018, 11:10pm
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
If you require a dump of the post on your message board, please come to the support board and request it.
Saving transparent GIFs
« Thread started on: Oct 9th, 2013, 11:47pm »
The Wiki article Saving a GIF image gives code to save a GIF. Is it possible to specify a transparent colour in the saved GIF?
I've spent about an hour trawling through online GDIPlus documentation, and actually ended up back at the Wiki! I could do it by manually opening the saved file and adding a GIF extension block with the required data, so if the GDIPlus functions don't support it I'll write an updated library function to let you specify a transparency.
The Wiki article Saving a GIF image gives code to save a GIF. Is it possible to specify a transparent colour in the saved GIF?
I believe it to be quite straightforward. The Microsoft documentation states of GDI+ that "The GIF encoder identifies the first color in the ColorPalette that has an Alpha value of ZERO as the transparent color".
So it should be sufficient to modify your colour palette (either in the source BMP file or in memory) such that the desired transparent colour has an alpha value of zero and all the others have an alpha value of 255.
However I have not tried this myself and with Windows graphics you can never be sure things will work 'sensibly'! So if you have difficulties or you find it doesn't work ask here again.