[gimp] Issue #3264 - Wrong colors from opening and exporting non-sRGB tiffs...



commit 84ffcddaef5d91e5bdf9a200bb6d09912d2c8b0a
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jun 11 21:51:16 2019 +0200

    Issue #3264 - Wrong colors from opening and exporting non-sRGB tiffs...
    
    ...and pngs
    
    Create formats with the drawable's space so no conversions happen when
    reading/writing the drawable's buffer. Original patches from Massimo.

 plug-ins/file-tiff/file-tiff-load.c | 6 ++++++
 plug-ins/file-tiff/file-tiff-save.c | 3 +++
 2 files changed, 9 insertions(+)
---
diff --git a/plug-ins/file-tiff/file-tiff-load.c b/plug-ins/file-tiff/file-tiff-load.c
index d1cc064b09..32445162bb 100644
--- a/plug-ins/file-tiff/file-tiff-load.c
+++ b/plug-ins/file-tiff/file-tiff-load.c
@@ -980,6 +980,12 @@ load_image (GFile              *file,
            */
           base_format = gimp_drawable_get_format (layer);
         }
+      else
+        {
+          base_format =
+            babl_format_with_space (babl_format_get_encoding (base_format),
+                                    gegl_buffer_get_format (channel[0].buffer));
+        }
 
       channel[0].ID     = layer;
       channel[0].buffer = gimp_drawable_get_buffer (layer);
diff --git a/plug-ins/file-tiff/file-tiff-save.c b/plug-ins/file-tiff/file-tiff-save.c
index df7cba355a..653fb0d7c4 100644
--- a/plug-ins/file-tiff/file-tiff-save.c
+++ b/plug-ins/file-tiff/file-tiff-save.c
@@ -590,6 +590,9 @@ save_layer (TIFF         *tif,
       goto out;
     }
 
+  format = babl_format_with_space (babl_format_get_encoding (format),
+                                   gegl_buffer_get_format (buffer));
+
   bytesperrow = cols * babl_format_get_bytes_per_pixel (format);
 
   if (compression == COMPRESSION_CCITTFAX3 ||


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