[gimp] app: fix an assertion when converting grayscale images to indexed.



commit c0e605ef96eaa94528a912ebf1b5d07a163cbaf4
Author: Jehan <jehan girinstud io>
Date:   Sat Apr 24 14:12:57 2021 +0200

    app: fix an assertion when converting grayscale images to indexed.
    
    We cannot just compare the drawable format with the model-type specs of
    the color model. We need to include the space now.
    In my case, some random screenshot converted to gray then indexed would
    assert because the format is "Y' u8-space-gray-sRGB" (or for layers with
    alpha: "Y'A u8-space-gray-sRGB"), hence indexed conversion failed and
    ended up dark.

 app/core/gimpimage-convert-indexed.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpimage-convert-indexed.c b/app/core/gimpimage-convert-indexed.c
index a564e0a560..60f65abbc9 100644
--- a/app/core/gimpimage-convert-indexed.c
+++ b/app/core/gimpimage-convert-indexed.c
@@ -1131,8 +1131,8 @@ generate_histogram_gray (CFHistogram  histogram,
 
   format = gimp_drawable_get_format (GIMP_DRAWABLE (layer));
 
-  g_return_if_fail (format == babl_format ("Y' u8") ||
-                    format == babl_format ("Y'A u8"));
+  g_return_if_fail (format == babl_format_with_space ("Y' u8", format) ||
+                    format == babl_format_with_space ("Y'A u8", format));
 
   bpp       = babl_format_get_bytes_per_pixel (format);
   has_alpha = babl_format_has_alpha (format);


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