diff --git a/src/modules/image/image.h b/src/modules/image/image.h
index fa3359b8d9ac43047bde7da30ce0135ccee21f6a..64450704b0cc3a79e23354d90648bae4e9ac51db 100644
--- a/src/modules/image/image.h
+++ b/src/modules/image/image.h
@@ -63,3 +63,5 @@ void image_floyd_steinberg(rgb_group *rgb,int xsize,
 			   int way,int *res,
 			   struct colortable *ct);
 
+int image_decode_gif(struct image *dest,struct image *dest_alpha,
+		     unsigned char *src,unsigned long len);
diff --git a/src/modules/image/lzw.c b/src/modules/image/lzw.c
index a2960e8abe90618c1bac7e955026c4933a3c5213..cb6a0e0091d8f0d69c2948abc26a9db3d60ec11e 100644
--- a/src/modules/image/lzw.c
+++ b/src/modules/image/lzw.c
@@ -90,7 +90,7 @@ static void lzw_recurse_find_code(struct lzw *lzw,lzwcode_t codeno)
 }
 #endif
 
-static void lzw_output(struct lzw *lzw,lzwcode_t codeno)
+static INLINE void lzw_output(struct lzw *lzw,lzwcode_t codeno)
 {
    int bits,bitp;
    unsigned char c;
diff --git a/src/modules/image/lzw.h b/src/modules/image/lzw.h
index 8ccd27345923c562341fc433d2e25dfc76c3043a..9c5235b0917c16523fe917f1b1c3a238f32dd4a9 100644
--- a/src/modules/image/lzw.h
+++ b/src/modules/image/lzw.h
@@ -15,15 +15,24 @@ struct lzw
    unsigned char *out,lastout;
    struct lzwc 
    {
-      lzwcode_t no;
       unsigned char c;
-      struct lzwc *firstchild;
-      struct lzwc *next;
-   } *code,*current;
+      lzwcode_t firstchild;
+      lzwcode_t next;
+   } *code;
+   lzwcode_t current,firstfree;
+#ifndef GIF_LZW
+   unsigned long alloced;
+#endif
 };
 
+#define LZWCNULL ((lzwcode_t)(~0))
+
 void lzw_add(struct lzw *lzw,int c);
 void lzw_quit(struct lzw *lzw);
 void lzw_init(struct lzw *lzw,int bits);
+unsigned long lzw_unpack(unsigned char *dest,unsigned long destlen,
+			 unsigned char *src,unsigned long srclen,
+			 int bits);
+