>TGA and XCF both have INDEXED modes, so you can save TGA or XCF from >an INDEXED image, you *should* be able to save INDEXED PNGs with an >alpha channel, but I only recently checked in the functionality to >do that, and doubtless you have an older version of Gimp. This is 1.1.19. From png.c: case INDEXEDA_IMAGE : g_message (_("Can't save image with alpha\n")); return 0; break; I won't fix that right away (maybe later, if I have time). >XPM doesn't have an INDEXED mode at all -- how then should Gimp save >your XPM? Since you're a developer, not just a humble end user, it >is expected that you'll take care of that sort of thing yourself. Sorry, I didn't mean to whine (I was determined to fix it myself but all sorts of things cropped up). XPM is by definition an indexed image format, though it allows for colormaps large enough for saving RGB images. It was a surviving bug in the XPM plugin (got the argument count wrong). I also changed the threshold from a 0..1 double to a 0..255 int, for consistency with threshold_alpha. I found one curious line, xpm.c:170: "saves files in the xpm file format (if you're on a 16 bit display...)", However, a cursory glance revealed nothing supporting this warning. Perhaps it was true in an earlier revision? Then we should change it. One problem with gimp-file-save is that for file plug-ins that need extra args, it simply passes zeroes (or empty strings). If this is the default, all is well, but not in this case (XPM). I have no quick solution. --- xpm.c~ Tue Mar 28 11:55:07 2000 +++ xpm.c Thu Apr 13 03:08:55 2000 @@ -53,7 +53,7 @@ /* Structs for the save dialog */ typedef struct { - gdouble threshold; + gint threshold; } XpmSaveVals; typedef struct @@ -113,7 +113,7 @@ static XpmSaveVals xpmvals = { - 0.50 /* alpha threshold */ + 127 /* alpha threshold */ }; static XpmSaveInterface xpmint = @@ -148,6 +148,7 @@ { PARAM_DRAWABLE, "drawable", "Drawable to save" }, { PARAM_STRING, "filename", "The name of the file to save the image in" }, { PARAM_STRING, "raw_filename", "The name of the file to save the image in" }, + { PARAM_INT32, "threshold", "Alpha threshold (0-255)" } }; static gint nsave_args = sizeof (save_args) / sizeof (save_args[0]); @@ -267,16 +268,16 @@ case RUN_NONINTERACTIVE: /* Make sure all the arguments are there! */ - if (nparams != 4) + if (nparams != 6) { status = STATUS_CALLING_ERROR; } else { - xpmvals.threshold = param[4].data.d_float; + xpmvals.threshold = param[5].data.d_int32; - if (xpmvals.threshold < 0.0 || - xpmvals.threshold > 1.0) + if (xpmvals.threshold < 0 || + xpmvals.threshold > 255) status = STATUS_CALLING_ERROR; } break; @@ -570,7 +571,7 @@ GHashTable *hash = NULL; gint i, j, k; - gint threshold = 255 * xpmvals.threshold; + gint threshold = xpmvals.threshold; gint rc = FALSE; @@ -824,11 +825,12 @@ scale_data = gimp_scale_entry_new (GTK_TABLE (table), 0, 0, _("Alpha Threshold:"), SCALE_WIDTH, 0, - xpmvals.threshold, 0.0, 1.0, 0.01, 0.1, 2, + xpmvals.threshold, 0, 255, 1, 8, 0, TRUE, 0, 0, NULL, NULL); + gtk_signal_connect (GTK_OBJECT (scale_data), "value_changed", - GTK_SIGNAL_FUNC (gimp_double_adjustment_update), + GTK_SIGNAL_FUNC (gimp_int_adjustment_update), &xpmvals.threshold); gtk_widget_show (dlg);