diff --git a/gdk-pixbuf/gdk-pixbuf-csource.c b/gdk-pixbuf/gdk-pixbuf-csource.c
index b774d0c..b450434 100644
--- a/gdk-pixbuf/gdk-pixbuf-csource.c
+++ b/gdk-pixbuf/gdk-pixbuf-csource.c
@@ -48,6 +48,7 @@ static guint    gen_type = GDK_PIXDATA_DUMP_PIXDATA_STREAM;
 static guint    gen_ctype = GDK_PIXDATA_DUMP_GTYPES | GDK_PIXDATA_DUMP_STATIC | GDK_PIXDATA_DUMP_CONST;
 static gboolean use_rle = TRUE;
 static gboolean with_decoder = FALSE;
+static gboolean gen_cencoding = GDK_PIXDATA_DUMP_C_ENCODING_STRING;
 static gchar   *image_name = "my_pixbuf";
 static gboolean	build_list = FALSE;
 
@@ -64,7 +65,8 @@ print_csource (FILE *f_out,
   free_me = gdk_pixdata_from_pixbuf (&pixdata, pixbuf, use_rle);
   gstring = gdk_pixdata_to_csource (&pixdata, image_name,
 				    gen_type | gen_ctype |
-				    (with_decoder ? GDK_PIXDATA_DUMP_RLE_DECODER : 0));
+				    (with_decoder ? GDK_PIXDATA_DUMP_RLE_DECODER : 0) |
+				    gen_cencoding);
 
   g_fprintf (f_out, "%s\n", gstring->str);
 
@@ -247,6 +249,16 @@ parse_args (gint    *argc_p,
 
 	  argv[i] = NULL;
 	}
+      else if (strcmp (argv[i], "--c-string") == 0)
+	{
+	  gen_cencoding = GDK_PIXDATA_DUMP_C_ENCODING_STRING;
+	  argv[i] = NULL;
+	}
+      else if (strcmp (argv[i], "--c-array") == 0)
+	{
+	  gen_cencoding = GDK_PIXDATA_DUMP_C_ENCODING_ARRAY;
+	  argv[i] = NULL;
+	}
     }
 
   e = 0;
@@ -296,6 +308,8 @@ print_blurb (FILE    *bout,
       g_fprintf (bout, "  --decoder                  provide rle decoder\n");
       g_fprintf (bout, "  --name=identifier          C macro/variable name\n");
       g_fprintf (bout, "  --build-list               parse (name, image) pairs\n");
+      g_fprintf (bout, "  --c-string                 put pixbuf data in a C string (default)\n");
+      g_fprintf (bout, "  --c-array                  put pixbuf data in a C array (only for --stream)\n");
       g_fprintf (bout, "  -h, --help                 show this help message\n");
       g_fprintf (bout, "  -v, --version              print version informations\n");
       g_fprintf (bout, "  --g-fatal-warnings         make warnings fatal (abort)\n");
diff --git a/gdk-pixbuf/gdk-pixdata.c b/gdk-pixbuf/gdk-pixdata.c
index ed60ab5..1bb5467 100644
--- a/gdk-pixbuf/gdk-pixdata.c
+++ b/gdk-pixbuf/gdk-pixdata.c
@@ -507,6 +507,7 @@ typedef struct {
   gboolean     dump_macros;
   gboolean     dump_gtypes;
   gboolean     dump_rle_decoder;
+  gboolean     dump_hex_array;
   const gchar *static_prefix;
   const gchar *const_prefix;
   /* runtime */
@@ -516,11 +517,53 @@ typedef struct {
 } CSourceData;
 
 static inline void
+save_hex_byte (CSourceData *cdata,
+	       guint8       d,
+	       gboolean     last_byte)
+{
+  GString *gstring = cdata->gstring;
+
+  if (cdata->pos > 70)
+    {
+      if (cdata->dump_struct || cdata->dump_stream)
+	{
+	  g_string_append (gstring, "\n  ");
+	  cdata->pos = 2;
+	  cdata->pad = FALSE;
+	}
+      if (cdata->dump_macros)
+	{
+	  g_string_append (gstring, " \\\n  ");
+	  cdata->pos = 2;
+	  cdata->pad = FALSE;
+	}
+    }
+
+  APPEND (gstring, "0x%02x", d);
+  cdata->pos += 4;
+  if (!last_byte)
+    {
+      APPEND (gstring, ", ");
+      cdata->pos += 2;
+    }
+
+  cdata->pad = FALSE;
+  return;
+}
+
+static inline void
 save_uchar (CSourceData *cdata,
-	    guint8       d)
+	    guint8       d,
+	    gboolean     last_byte)
 {
   GString *gstring = cdata->gstring;
 
+  if (cdata->dump_hex_array)
+    {
+      save_hex_byte(cdata, d, last_byte);
+      return;
+    }
+
   if (cdata->pos > 70)
     {
       if (cdata->dump_struct || cdata->dump_stream)
@@ -662,6 +705,8 @@ gdk_pixdata_to_csource (GdkPixdata        *pixdata,
   cdata.dump_struct = (dump_type & GDK_PIXDATA_DUMP_PIXDATA_STRUCT) > 0;
   cdata.dump_stream = !cdata.dump_macros && !cdata.dump_struct;
   g_return_val_if_fail (cdata.dump_macros + cdata.dump_struct + cdata.dump_stream == 1, NULL);
+  cdata.dump_hex_array = (dump_type & GDK_PIXDATA_DUMP_C_ENCODING_ARRAY) > 0 && cdata.dump_stream;
+  gchar *QUOTES = cdata.dump_hex_array ? "" : "\"";
 
   cdata.dump_gtypes = (dump_type & GDK_PIXDATA_DUMP_CTYPES) == 0;
   cdata.dump_rle_decoder = (dump_type & GDK_PIXDATA_DUMP_RLE_DECODER) > 0;
@@ -751,36 +796,36 @@ gdk_pixdata_to_csource (GdkPixdata        *pixdata,
 	      name);
       APPEND (gstring, "#endif\n");
 
-      APPEND (gstring, "{ \"\"\n  /* Pixbuf magic (0x%x) */\n  \"",
-	      GDK_PIXBUF_MAGIC_NUMBER);
+      APPEND (gstring, "{ %s%s\n  /* Pixbuf magic (0x%x) */\n  %s",
+	      QUOTES, QUOTES, GDK_PIXBUF_MAGIC_NUMBER, QUOTES);
       cdata.pos = 3;
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      APPEND (gstring, "\"\n  /* length: header (%d) + pixel_data (%u) */\n  \"",
-	      GDK_PIXDATA_HEADER_LENGTH,
-	      rle_encoded ? pix_length : rowstride * height);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      APPEND (gstring, "%s\n  /* length: header (%d) + pixel_data (%u) */\n  %s",
+	      QUOTES, GDK_PIXDATA_HEADER_LENGTH,
+	      rle_encoded ? pix_length : rowstride * height, QUOTES);
       cdata.pos = 3;
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      APPEND (gstring, "\"\n  /* pixdata_type (0x%x) */\n  \"",
-	      pixdata->pixdata_type);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      APPEND (gstring, "%s\n  /* pixdata_type (0x%x) */\n  %s",
+	      QUOTES, pixdata->pixdata_type, QUOTES);
       cdata.pos = 3;
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      APPEND (gstring, "\"\n  /* rowstride (%u) */\n  \"",
-	      rowstride);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      APPEND (gstring, "%s\n  /* rowstride (%u) */\n  %s",
+	      QUOTES, rowstride, QUOTES);
       cdata.pos = 3;
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      APPEND (gstring, "\"\n  /* width (%u) */\n  \"", width);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      APPEND (gstring, "%s\n  /* width (%u) */\n  %s", QUOTES, width, QUOTES);
       cdata.pos = 3;
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      APPEND (gstring, "\"\n  /* height (%u) */\n  \"", height);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      APPEND (gstring, "%s\n  /* height (%u) */\n  %s", QUOTES, height, QUOTES);
       cdata.pos = 3;
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
-      APPEND (gstring, "\"\n  /* pixel_data: */\n");
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      save_uchar (&cdata, *img_buffer++, FALSE); save_uchar (&cdata, *img_buffer++, FALSE);
+      APPEND (gstring, "%s\n  /* pixel_data: */\n", QUOTES);
     }
 
   /* pixel_data intro
@@ -801,14 +846,17 @@ gdk_pixdata_to_csource (GdkPixdata        *pixdata,
     }
   if (cdata.dump_stream)
     {
-      APPEND (gstring, "  \"");
+      APPEND (gstring, "  %s", QUOTES);
       cdata.pos = 3;
     }
     
   /* pixel_data
    */
   do
-    save_uchar (&cdata, *img_buffer++);
+    {
+      save_uchar (&cdata, *img_buffer, img_buffer == img_buffer_end - 1);
+      img_buffer++;
+    }
   while (img_buffer < img_buffer_end);
 
   /* pixel_data trailer
@@ -818,7 +866,7 @@ gdk_pixdata_to_csource (GdkPixdata        *pixdata,
   if (cdata.dump_struct)
     APPEND (gstring, "\",\n};\n\n");
   if (cdata.dump_stream)
-    APPEND (gstring, "\"};\n\n");
+    APPEND (gstring, "%s};\n\n", QUOTES);
 
   /* dump RLE decoder for macros
    */
diff --git a/gdk-pixbuf/gdk-pixdata.h b/gdk-pixbuf/gdk-pixdata.h
index eb85034..7293e81 100644
--- a/gdk-pixbuf/gdk-pixdata.h
+++ b/gdk-pixbuf/gdk-pixdata.h
@@ -136,12 +136,15 @@ GdkPixbuf*	gdk_pixbuf_from_pixdata	(const GdkPixdata	*pixdata,
  * @GDK_PIXDATA_DUMP_CONST: Generate const symbols.
  * @GDK_PIXDATA_DUMP_RLE_DECODER: Provide a <function>*_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp)</function> 
  *    macro definition  to  decode  run-length encoded image data.
+ * @GDK_PIXDATA_DUMP_C_ENCODING_STRING: Pixel data is declared as a string.
+ * @GDK_PIXDATA_DUMP_C_ENCODING_ARRAY: Pixel data is declared as an array (only for Stream outputs).
  *  
  * An enumeration which is used by gdk_pixdata_to_csource() to
  * determine the form of C source to be generated. The three values
  * @GDK_PIXDATA_DUMP_PIXDATA_STREAM, @GDK_PIXDATA_DUMP_PIXDATA_STRUCT
  * and @GDK_PIXDATA_DUMP_MACROS are mutually exclusive, as are
- * @GDK_PIXBUF_DUMP_GTYPES and @GDK_PIXBUF_DUMP_CTYPES. The remaining
+ * @GDK_PIXDATA_DUMP_GTYPES and @GDK_PIXDATA_DUMP_CTYPES on one hand, and
+ * @GDK_PIXDATA_DUMP_C_ENCODING_STRING and @GDK_PIXDATA_DUMP_C_ENCODING_ARRAY on the other. The remaining
  * elements are optional flags that can be freely added. 
  **/
 typedef enum
@@ -156,7 +159,10 @@ typedef enum
   GDK_PIXDATA_DUMP_STATIC		= 1 << 9,
   GDK_PIXDATA_DUMP_CONST		= 1 << 10,
   /* save RLE decoder macro? */
-  GDK_PIXDATA_DUMP_RLE_DECODER		= 1 << 16
+  GDK_PIXDATA_DUMP_RLE_DECODER		= 1 << 16,
+  /* C encoding of the pixel data */
+  GDK_PIXDATA_DUMP_C_ENCODING_STRING	= 0,
+  GDK_PIXDATA_DUMP_C_ENCODING_ARRAY	= 1 << 24
 } GdkPixdataDumpType;
   
 
