I have some AVI files that I want to convert to animated gifs with transparent backgrounds to place on a .net Windows form. I am able to convert from AVI to animated gifs but for some reason the background of the animated gif is pink instead of transparent. Is there some simple way to get rid of the pink colors from the resulting animated gif file? I tried ffmpeg but it also produced the pink color. I tried ffmpeg -i FINDFILE.avi FINDFILE.gif. It produced the animated gif but the background color is pink. Thanks for reading this.
1 Answers
Try editing the palette with IrfanView or any sophisticated image editing program. There should be a checkbox for "transparent background" somewhere.
If you can“t find any tool that works, you may have to dig deeper and edit the binary. http://www.u229.no/stuff/gifformat/ explains the data format: The interesting part are the Graphics Control Extensions, which contain the Transparent Color Index and the Transparent Color Flag in a packed field.
Beware: Each frame may have its own GCE. But each block starts with a signature of three bytes \x21\xf9\x04, so they are easy to track down.
The next byte after the signature is the packed field; bit 0 is the Transparent Color Flag. So search for \x00\x21\xf9\x04, if the value of the next byte is even: add one (set bit 0 in that byte).
Store the file, and the background should be transparent on all frames.
Or ... just found it ... take a look at this thread: How to make transparent background of a gif animation?