diff -rNU4 fltk-1.3.4-1.old/src/Fl_GIF_Image.cxx fltk-1.3.4-1/src/Fl_GIF_Image.cxx
--- fltk-1.3.4-1.old/src/Fl_GIF_Image.cxx	2011-07-19 06:49:30.000000000 +0200
+++ fltk-1.3.4-1/src/Fl_GIF_Image.cxx	2016-09-06 17:22:25.261979939 +0200
@@ -335,19 +335,14 @@
     Blue[0]                  = Blue[transparent_pixel];
     Blue[transparent_pixel]  = t;
   }
 
-  // find out what colors are actually used:
-  uchar used[256]; uchar remap[256];
+  // remap colors to start with printing characters:
+  uchar remap[256];
   int i;
-  for (i = 0; i < ColorMapSize; i++) used[i] = 0;
-  p = Image+Width*Height;
-  while (p-- > Image) used[*p] = 1;
-
-  // remap them to start with printing characters:
-  int base = has_transparent && used[0] ? ' ' : ' '+1;
+  int base = has_transparent ? ' ' : ' '+1;
   int numcolors = 0;
-  for (i = 0; i < ColorMapSize; i++) if (used[i]) {
+  for (i = 0; i < ColorMapSize; i++) {
     remap[i] = (uchar)(base++);
     numcolors++;
   }
 
@@ -358,9 +353,9 @@
   strcpy(new_data[0], (char*)Suffix);
 
   // write the colormap
   new_data[1] = (char*)(p = new uchar[4*numcolors]);
-  for (i = 0; i < ColorMapSize; i++) if (used[i]) {
+  for (i = 0; i < ColorMapSize; i++) {
     *p++ = remap[i];
     *p++ = Red[i];
     *p++ = Green[i];
     *p++ = Blue[i];
