A Transparent GIF Conversion Utility in C#

Download GIFTran.zip

We often need images with transparent background when creating websites. Most people would use PhotoShop or some other commercial tools to achieve such effects.

A while back, I found the need to batch convert GIF images with various background colors to images with transparent background. And due to the volume of the task, using PhotoShop would take way too much time. So I decided to write a utility to automatically perform this task. I had almost forgotten that I had such a utility until quite recently when someone asked me for the tool. The program itself is not all that complicated. I did refer to a C program somewhere on the Internet (please email me if you think you originally created the program so that I can properly credit it), but the most helpful resource is the GIF specification which I used quite a bit when creating this utility.

The following lines of code demonstrate how to use it :

GifTran.TransparentGIF tgif = new GifTran.TransparentGIF(@"c:\temp\test.gif"); // RGB(49,100,156) would become transparent tgif.MakeTransparent(49,100,156);

Be Sociable, Share!

Leave a Reply