[gimp/wip/wormnest/issue-6886] Change: Allow loading of indexed images with linear precision.




commit 05892115d658349fd5fea034e37f0ea204b2fbf7
Author: Jacob Boerema <jgboerema gmail com>
Date:   Tue Jul 13 17:27:06 2021 -0400

    Change: Allow loading of indexed images with linear precision.
    
    This fixes #6886 where certain indexed png images fail to load.
    
    As far as I can see babl supports loading of indexed linear precision
    images, so lets change the checks that prohibited loading of these images.
    
    Also add a console error when precision is not U8 for GIMP_INDEXED.

 app/core/gimpimage.c | 5 ++++-
 app/gegl/gimp-babl.c | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 8ba4961d68..ab47f1c62a 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -2085,13 +2085,16 @@ gimp_image_get_format (GimpImage         *image,
       return gimp_babl_format (base_type, precision, with_alpha, space);
 
     case GIMP_INDEXED:
-      if (precision == GIMP_PRECISION_U8_NON_LINEAR)
+      if (precision == GIMP_PRECISION_U8_NON_LINEAR ||
+          precision == GIMP_PRECISION_U8_LINEAR)
         {
           if (with_alpha)
             return gimp_image_colormap_get_rgba_format (image);
           else
             return gimp_image_colormap_get_rgb_format (image);
         }
+      else
+        g_printerr ("Error: unhandled precision %d for GIMP_INDEXED", precision);
     }
 
   g_return_val_if_reached (NULL);
diff --git a/app/gegl/gimp-babl.c b/app/gegl/gimp-babl.c
index e8bf2647b5..db569817df 100644
--- a/app/gegl/gimp-babl.c
+++ b/app/gegl/gimp-babl.c
@@ -814,6 +814,7 @@ gimp_babl_is_valid (GimpImageBaseType base_type,
       switch (precision)
         {
         case GIMP_PRECISION_U8_NON_LINEAR:
+        case GIMP_PRECISION_U8_LINEAR:
           return TRUE;
 
         default:


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