--- winicon/icodialog.c	2006-10-05 20:57:34.000000000 +0300
+++ winicon-24bit/icodialog.c	2006-10-05 20:37:03.000000000 +0300
@@ -157,6 +157,7 @@ ico_create_icon_hbox (GtkWidget   *icon_
   combo = gimp_int_combo_box_new (_("1 bpp, 1-bit alpha, 2-slot palette"),   1,
                                   _("4 bpp, 1-bit alpha, 16-slot palette"),  4,
                                   _("8 bpp, 1-bit alpha, 256-slot palette"), 8,
+                                  _("24 bpp, 1-bit alpha, no palette"),     24,
                                   _("32 bpp, 8-bit alpha, no palette"),     32,
                                   NULL);
   gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
@@ -308,6 +309,70 @@ ico_dialog_update_icon_preview (GtkWidge
 
       gimp_image_delete (tmp_image);
     }
+  else if (bpp == 24)
+    {
+      GimpDrawable *drawable;
+      GimpDrawable *tmp;
+      GimpPixelRgn  src_pixel_rgn, dst_pixel_rgn;
+      gint32        image;
+      gint32        tmp_image;
+      gint32        tmp_layer;
+      guchar       *buffer;
+      GimpParam    *return_vals;
+      gint          n_return_vals;
+
+      image = gimp_drawable_get_image (layer);
+
+      tmp_image = gimp_image_new (w, h, gimp_image_base_type (image));
+      gimp_image_undo_disable (tmp_image);
+
+      if (gimp_drawable_is_indexed (layer))
+        {
+          guchar *cmap;
+          gint    num_colors;
+
+          cmap = gimp_image_get_colormap (image, &num_colors);
+          gimp_image_set_colormap (tmp_image, cmap, num_colors);
+          g_free (cmap);
+        }
+
+      tmp_layer = gimp_layer_new (tmp_image, "temporary", w, h,
+                                  gimp_drawable_type (layer),
+                                  100, GIMP_NORMAL_MODE);
+      gimp_image_add_layer (tmp_image, tmp_layer, 0);
+
+      drawable = gimp_drawable_get (layer);
+      tmp      = gimp_drawable_get (tmp_layer);
+
+      gimp_pixel_rgn_init (&src_pixel_rgn, drawable, 0, 0, w, h, FALSE, FALSE);
+      gimp_pixel_rgn_init (&dst_pixel_rgn, tmp,      0, 0, w, h, TRUE, FALSE);
+
+      buffer = g_malloc (w * h * 4);
+      gimp_pixel_rgn_get_rect (&src_pixel_rgn, buffer, 0, 0, w, h);
+      gimp_pixel_rgn_set_rect (&dst_pixel_rgn, buffer, 0, 0, w, h);
+      g_free (buffer);
+
+      gimp_drawable_detach (tmp);
+      gimp_drawable_detach (drawable);
+
+      if (gimp_drawable_is_indexed (layer))
+        gimp_image_convert_rgb (tmp_image);
+
+      return_vals =
+        gimp_run_procedure ("plug-in-threshold-alpha", &n_return_vals,
+                            GIMP_PDB_INT32, GIMP_RUN_NONINTERACTIVE,
+                            GIMP_PDB_IMAGE, tmp_image,
+                            GIMP_PDB_DRAWABLE, tmp_layer,
+                            GIMP_PDB_INT32, ICO_ALPHA_THRESHOLD,
+                            GIMP_PDB_END);
+      gimp_destroy_params (return_vals, n_return_vals);
+
+      pixbuf = gimp_drawable_get_thumbnail (tmp_layer,
+                                            MIN (w, 128), MIN (h, 128),
+                                            GIMP_PIXBUF_SMALL_CHECKS);
+
+      gimp_image_delete (tmp_image);
+    }
   else
     {
       pixbuf = gimp_drawable_get_thumbnail (layer,
--- winicon/icosave.c	2006-10-05 20:52:54.000000000 +0300
+++ winicon-24bit/icosave.c	2006-10-05 19:23:53.000000000 +0300
@@ -190,6 +190,11 @@ ico_save_init (gint32 image_ID, IcoSaveI
               /* Let's suggest 8bpp */
               info->default_depths [i] = 8;
             }
+          else
+            {
+              /* Let's suggest 24bpp */
+              info->default_depths [i] = 24;
+            }
         }
       else
         {
@@ -546,7 +551,7 @@ ico_image_get_reduced_buf (guint32   lay
 
   buffer = g_new (guchar, w * h * 4);
 
-  if (bpp <= 8 || drawable->bpp != 4)
+  if (bpp <= 8 || bpp == 24 || drawable->bpp != 4)
     {
       gint32        image = gimp_drawable_get_image (layer);
       GimpDrawable *tmp;
@@ -630,6 +635,20 @@ ico_image_get_reduced_buf (guint32   lay
 
           gimp_image_convert_rgb (tmp_image);
         }
+      else if (bpp == 24)
+        {
+          GimpParam    *return_vals;
+          gint          n_return_vals;
+
+          return_vals =
+            gimp_run_procedure ("plug-in-threshold-alpha", &n_return_vals,
+                                GIMP_PDB_INT32, GIMP_RUN_NONINTERACTIVE,
+                                GIMP_PDB_IMAGE, tmp_image,
+                                GIMP_PDB_DRAWABLE, tmp_layer,
+                                GIMP_PDB_INT32, ICO_ALPHA_THRESHOLD,
+                                GIMP_PDB_END);
+          gimp_destroy_params (return_vals, n_return_vals);
+        }
 
       gimp_layer_add_alpha (tmp_layer);
 
@@ -665,6 +684,7 @@ ico_write_icon (FILE   *fp,
   guint32           *buffer32;
   guchar            *palette;
   GHashTable        *color_to_slot = NULL;
+  guchar            *row;
   guchar            *xor_map, *and_map;
 
   guint32           *palette32 = NULL;
@@ -809,6 +829,21 @@ ico_write_icon (FILE   *fp,
           }
       break;
 
+    case 24:
+      for (y = 0; y < height; y++)
+        {
+          row = xor_map + (xor_len*(height-y-1) / height);
+          for (x = 0; x < height; x++)
+            {
+              pixel = (guint8 *) &buffer32[y * width + x];
+              row[0] = pixel[2];
+              row[1] = pixel[1];
+              row[2] = pixel[0];
+              row += 3;
+            }
+        }
+      break;
+
     default:
       for (y = 0; y < height; y++)
         for (x = 0; x < width; x++)
