[FFmpeg-devel] [PATCH]Animated gif transparency

Carl Eugen Hoyos cehoyos at ag.or.at
Thu Dec 20 11:46:08 CET 2012


Hi!

Attached fixes the transparency issues with animated gifs here.
Additionally, it fixes a problem with the background colour, 
can be tested by comparing display -alpha off with ffplay output.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
index 53b1bb8..d869e25 100644
--- a/libavcodec/gifdec.c
+++ b/libavcodec/gifdec.c
@@ -241,8 +241,9 @@ static int gif_read_image(GifState *s)
         pr = ptr + width;
 
         for (px = ptr, idx = s->idx_line; px < pr; px++, idx++) {
-            if (*idx != s->transparent_color_index)
-                *px = pal[*idx];
+            *px = pal[*idx];
+            if (*idx == s->transparent_color_index)
+                *px &= 0xFFFFFF;
         }
 
         if (is_interleaved) {


More information about the ffmpeg-devel mailing list