[gimp] plug-ins: add non interactive support for extra parameters in file-bmp-save



commit d94a0c00af55c70f0eb452c790414110d2629e2c
Author: Jacob Boerema <jgboerema gmail com>
Date:   Thu Aug 5 16:18:24 2021 -0400

    plug-ins: add non interactive support for extra parameters in file-bmp-save
    
    When exporting to bmp using a script or plug-in we could not set the
    parameters use-rle, write-color-space-info, and rgb-format when used
    non-interactively.
    
    This is discussed in issue #491. The patch there does not work for master,
    so I came up with this.

 plug-ins/file-bmp/bmp-save.c | 26 ++++++++++++++++++--------
 plug-ins/file-bmp/bmp.c      | 37 ++++++++++++++++++++-----------------
 2 files changed, 38 insertions(+), 25 deletions(-)
---
diff --git a/plug-ins/file-bmp/bmp-save.c b/plug-ins/file-bmp/bmp-save.c
index 3dbd8f2310..07676506f4 100644
--- a/plug-ins/file-bmp/bmp-save.c
+++ b/plug-ins/file-bmp/bmp-save.c
@@ -165,10 +165,15 @@ save_image (GFile         *file,
       MapSize      = 0;
       channels     = 4;
 
-      g_object_set (config,
-                    "rgb-format", RGBA_8888,
-                    "use-rle",    FALSE,
-                    NULL);
+      if (run_mode == GIMP_RUN_INTERACTIVE)
+        g_object_set (config,
+                      "rgb-format", RGBA_8888,
+                      "use-rle",    FALSE,
+                      NULL);
+      else
+        g_object_set (config,
+                      "use-rle",    FALSE,
+                      NULL);
       break;
 
     case GIMP_RGB_IMAGE:
@@ -178,10 +183,15 @@ save_image (GFile         *file,
       MapSize      = 0;
       channels     = 3;
 
-      g_object_set (config,
-                    "rgb-format", RGBA_8888,
-                    "use-rle",    FALSE,
-                    NULL);
+      if (run_mode == GIMP_RUN_INTERACTIVE)
+        g_object_set (config,
+                      "rgb-format", RGB_888,
+                      "use-rle",    FALSE,
+                      NULL);
+      else
+        g_object_set (config,
+                      "use-rle",    FALSE,
+                      NULL);
       break;
 
     case GIMP_GRAYA_IMAGE:
diff --git a/plug-ins/file-bmp/bmp.c b/plug-ins/file-bmp/bmp.c
index efec66c1ea..3774fd5a48 100644
--- a/plug-ins/file-bmp/bmp.c
+++ b/plug-ins/file-bmp/bmp.c
@@ -189,24 +189,27 @@ bmp_create_procedure (GimpPlugIn  *plug_in,
       gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
                                           "bmp");
 
-      GIMP_PROC_AUX_ARG_BOOLEAN (procedure, "use-rle",
-                                 "Use RLE",
-                                 "Use run-lengh-encoding",
-                                 FALSE,
-                                 G_PARAM_READWRITE);
-
-      GIMP_PROC_AUX_ARG_BOOLEAN (procedure, "write-color-space-info",
-                                 "Write color space information",
-                                 "Whether or not to write BITMAPV5HEADER "
-                                 "color space data",
-                                 TRUE,
-                                 G_PARAM_READWRITE);
-
-      GIMP_PROC_AUX_ARG_INT (procedure, "rgb-format",
-                             "RGB format",
-                             "Export format for RGB images",
-                             0, 5, 3,
+      GIMP_PROC_ARG_BOOLEAN (procedure, "use-rle",
+                             "Use RLE",
+                             "Use run-lengh-encoding compression "
+                             "(only valid for 4 and 8-bit indexed images)",
+                             FALSE,
                              G_PARAM_READWRITE);
+
+      GIMP_PROC_ARG_BOOLEAN (procedure, "write-color-space-info",
+                             "Write color space information",
+                             "Whether or not to write BITMAPV5HEADER "
+                             "color space data",
+                             TRUE,
+                             G_PARAM_READWRITE);
+
+      GIMP_PROC_ARG_INT (procedure, "rgb-format",
+                         "RGB format",
+                         "Export format for RGB images "
+                         "(0=RGB_565, 1=RGBA_5551, 2=RGB_555, 3=RGB_888,"
+                         " 4=RGBA_8888, 5=RGBX_8888)",
+                         0, 5, 3,
+                         G_PARAM_READWRITE);
     }
 
   return procedure;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]