[gimp] plug-ins: gAMA chunk export is now a redundant option.



commit d57eafd1894de9b11f28a9ba937e14541c3af6f1
Author: Jehan <jehan girinstud io>
Date:   Fri Jan 29 19:57:14 2021 +0100

    plug-ins: gAMA chunk export is now a redundant option.
    
    Now when a gAMA chunk is set on an imported PNG (and if there is no
    profile attached), an equivalent profile is created out of the gAMA
    chunk. So the displayed image looks like it is supposed to.
    On export, the generated profile should simply be saved together in the
    PNG file. If not, the sRGB chunk is set anyway (and also an equivalent
    gAMA/cHRM as recommended in the specs).
    
    So basically we now have a proper support of the gAMA chunk, from import
    to export, and display within GIMP takes this metadata into account
    appropriately (in the shape of a generated equivalent profile).
    Therefore it looks to me keeping the option is redundant. It is even
    confusing (because it's actually hard to understand exactly what this
    data is about, even our documentation about this metadata seems to be
    wrong) hence possibly dangerous if someone thinks it is important,
    checks the box, which would override other data or simply create
    irrelevant or contradictory metadata.
    
    So let's just remove this option. Development releases are the right
    places anyway for people to notice this change and come to us if we
    missed some usage regarding this option.
    See also #5363.

 plug-ins/common/file-png.c | 41 -----------------------------------------
 1 file changed, 41 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index b03c3f36e4..dc517eca1b 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -245,12 +245,6 @@ png_create_procedure (GimpPlugIn  *plug_in,
                              TRUE,
                              G_PARAM_READWRITE);
 
-      GIMP_PROC_ARG_BOOLEAN (procedure, "gama",
-                             "Save _gamma",
-                             "Write gAMA chunk (PNG metadata)",
-                             FALSE,
-                             G_PARAM_READWRITE);
-
       GIMP_PROC_ARG_BOOLEAN (procedure, "offs",
                              "Save layer o_ffset",
                              "Write oFFs chunk (PNG metadata)",
@@ -958,23 +952,6 @@ load_image (GFile        *file,
    * due to a bug in libpng-1.0.6, see png-implement for details
    */
 
-  if (png_get_valid (pp, info, PNG_INFO_gAMA))
-    {
-      GimpParasite *parasite;
-      gchar         buf[G_ASCII_DTOSTR_BUF_SIZE];
-      gdouble       gamma;
-
-      png_get_gAMA (pp, info, &gamma);
-
-      g_ascii_dtostr (buf, sizeof (buf), gamma);
-
-      parasite = gimp_parasite_new ("gamma",
-                                    GIMP_PARASITE_PERSISTENT,
-                                    strlen (buf) + 1, buf);
-      gimp_image_attach_parasite ((GimpImage *) image, parasite);
-      gimp_parasite_free (parasite);
-    }
-
   if (png_get_valid (pp, info, PNG_INFO_oFFs))
     {
       gint offset_x = png_get_x_offset_pixels (pp, info);
@@ -1345,7 +1322,6 @@ save_image (GFile        *file,
 
   gboolean        save_interlaced;
   gboolean        save_bkgd;
-  gboolean        save_gama;
   gboolean        save_offs;
   gboolean        save_phys;
   gboolean        save_time;
@@ -1365,7 +1341,6 @@ save_image (GFile        *file,
   g_object_get (config,
                 "interlaced",         &save_interlaced,
                 "bkgd",               &save_bkgd,
-                "gama",               &save_gama,
                 "offs",               &save_offs,
                 "phys",               &save_phys,
                 "time",               &save_time,
@@ -1755,21 +1730,6 @@ save_image (GFile        *file,
       png_set_bKGD (pp, info, &background);
     }
 
-  if (save_gama)
-    {
-      GimpParasite *parasite;
-      gdouble       gamma = 1.0 / DEFAULT_GAMMA;
-
-      parasite = gimp_image_get_parasite (orig_image, "gamma");
-      if (parasite)
-        {
-          gamma = g_ascii_strtod (gimp_parasite_data (parasite), NULL);
-          gimp_parasite_free (parasite);
-        }
-
-      png_set_gAMA (pp, info, gamma);
-    }
-
   if (save_offs)
     {
       gimp_drawable_offsets (drawable, &offx, &offy);
@@ -2334,7 +2294,6 @@ save_dialog (GimpImage     *image,
                             alpha);
 
   gimp_save_procedure_dialog_add_metadata (GIMP_SAVE_PROCEDURE_DIALOG (dialog), "bkgd");
-  gimp_save_procedure_dialog_add_metadata (GIMP_SAVE_PROCEDURE_DIALOG (dialog), "gama");
   gimp_save_procedure_dialog_add_metadata (GIMP_SAVE_PROCEDURE_DIALOG (dialog), "offs");
   gimp_save_procedure_dialog_add_metadata (GIMP_SAVE_PROCEDURE_DIALOG (dialog), "phys");
   gimp_save_procedure_dialog_add_metadata (GIMP_SAVE_PROCEDURE_DIALOG (dialog), "time");


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