[gimp/gimp-2-10] plug-ins: fix not converting 8 bps grayscale MINISWHITE TIFF



commit c34a6c7d87420a9b7c1a82bae063dc14b2f1b503
Author: Jacob Boerema <jgboerema gmail com>
Date:   Wed Jun 8 14:34:03 2022 -0400

    plug-ins: fix not converting 8 bps grayscale MINISWHITE TIFF
    
    We only set tiff_mode for images with bps < 8, but we also use it for
    8 bps grayscale images to detect if MINISWHITE needs to be converted.
    
    So, let's always set tiff_mode for PALETTE, MINISBLACK and MINISWHITE.
    
    (cherry picked from commit 2e4b9bcba7367891005e6a5f388303460686d66f)

 plug-ins/file-tiff/file-tiff-load.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/file-tiff/file-tiff-load.c b/plug-ins/file-tiff/file-tiff-load.c
index 24c0257952..f61bfe34be 100644
--- a/plug-ins/file-tiff/file-tiff-load.c
+++ b/plug-ins/file-tiff/file-tiff-load.c
@@ -832,15 +832,17 @@ load_image (GFile        *file,
         case PHOTOMETRIC_PALETTE:
         case PHOTOMETRIC_MINISBLACK:
         case PHOTOMETRIC_MINISWHITE:
+          /* Even for bps >= we may need to use tiff_mode, so always set it.
+           * Currently we use it to detect the need to convert 8 bps miniswhite. */
+          if (photomet == PHOTOMETRIC_PALETTE)
+            tiff_mode = GIMP_TIFF_INDEXED;
+          else if (photomet == PHOTOMETRIC_MINISBLACK)
+            tiff_mode = GIMP_TIFF_GRAY;
+          else if (photomet == PHOTOMETRIC_MINISWHITE)
+            tiff_mode = GIMP_TIFF_GRAY_MINISWHITE;
+
           if (bps < 8)
             {
-              if (photomet == PHOTOMETRIC_PALETTE)
-                tiff_mode = GIMP_TIFF_INDEXED;
-              else if (photomet == PHOTOMETRIC_MINISBLACK)
-                tiff_mode = GIMP_TIFF_GRAY;
-              else if (photomet == PHOTOMETRIC_MINISWHITE)
-                tiff_mode = GIMP_TIFF_GRAY_MINISWHITE;
-
               /* FIXME: It should be a user choice whether this should be
                * interpreted as indexed or grayscale. For now we will
                * use indexed (see issue #6766). */


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