$NetBSD: patch-ab,v 1.3 2000/06/17 01:09:36 wiz Exp $

--- Imlib/load.c.orig	Sun Oct  3 21:17:35 1999
+++ Imlib/load.c	Sat Jun 17 02:58:25 2000
@@ -209,6 +209,9 @@
   /* Setup Translators */
   if (color_type == PNG_COLOR_TYPE_PALETTE)
     png_set_expand(png_ptr);
+  if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
+    png_set_expand(png_ptr);
+
   png_set_strip_16(png_ptr);
   png_set_packing(png_ptr);
   if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
@@ -247,7 +250,8 @@
   png_read_image(png_ptr, lines);
   png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
   ptr = data;
-  if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+  if (color_type == PNG_COLOR_TYPE_GRAY
+      || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
     {
       for (y = 0; y < *h; y++)
 	{
@@ -272,6 +276,7 @@
 	    }
 	}
     }
+#if 0
   else if (color_type == PNG_COLOR_TYPE_GRAY)
     {
       for (y = 0; y < *h; y++)
@@ -286,6 +291,7 @@
 	    }
 	}
     }
+#endif
   else
     {
       for (y = 0; y < *h; y++)
