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



commit 2e4b9bcba7367891005e6a5f388303460686d66f
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.

 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 f434c0833c..d3113a6528 100644
--- a/plug-ins/file-tiff/file-tiff-load.c
+++ b/plug-ins/file-tiff/file-tiff-load.c
@@ -821,15 +821,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]