[gimp] Bug 723392 - Pasting an image replaces color profile with default one



commit 802a53fa548b35f369dc38a4cfec9009a5779078
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 30 01:29:46 2015 +0200

    Bug 723392 - Pasting an image replaces color profile with default one
    
    gimp_image_duplicate(): set the new image's color profile *before*
    copying layers to it, or the new layers will be automatically
    converted to "no color profile aka sRGB", but then tagged with the
    original profile anyway.

 app/core/gimpimage-duplicate.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpimage-duplicate.c b/app/core/gimpimage-duplicate.c
index cd142f7..95d8993 100644
--- a/app/core/gimpimage-duplicate.c
+++ b/app/core/gimpimage-duplicate.c
@@ -28,6 +28,7 @@
 #include "gimpchannel.h"
 #include "gimpguide.h"
 #include "gimpimage.h"
+#include "gimpimage-color-profile.h"
 #include "gimpimage-colormap.h"
 #include "gimpimage-duplicate.h"
 #include "gimpimage-grid.h"
@@ -78,6 +79,8 @@ static void          gimp_image_duplicate_quick_mask       (GimpImage *image,
                                                             GimpImage *new_image);
 static void          gimp_image_duplicate_parasites        (GimpImage *image,
                                                             GimpImage *new_image);
+static void          gimp_image_duplicate_color_profile    (GimpImage *image,
+                                                            GimpImage *new_image);
 
 
 GimpImage *
@@ -110,6 +113,10 @@ gimp_image_duplicate (GimpImage *image)
   /*  Copy resolution information  */
   gimp_image_duplicate_resolution (image, new_image);
 
+  /*  Copy parasites first so we have a color profile  */
+  gimp_image_duplicate_parasites (image, new_image);
+  gimp_image_duplicate_color_profile (image, new_image);
+
   /*  Copy the layers  */
   active_layer = gimp_image_duplicate_layers (image, new_image);
 
@@ -153,9 +160,6 @@ gimp_image_duplicate (GimpImage *image)
   /*  Copy the quick mask info  */
   gimp_image_duplicate_quick_mask (image, new_image);
 
-  /*  Copy parasites  */
-  gimp_image_duplicate_parasites (image, new_image);
-
   gimp_image_undo_enable (new_image);
 
   return new_image;
@@ -512,3 +516,12 @@ gimp_image_duplicate_parasites (GimpImage *image,
       new_private->parasites = gimp_parasite_list_copy (private->parasites);
     }
 }
+
+static void
+gimp_image_duplicate_color_profile (GimpImage *image,
+                                    GimpImage *new_image)
+{
+  GimpColorProfile *profile = gimp_image_get_color_profile (image);
+
+  gimp_image_set_color_profile (new_image, profile, NULL);
+}


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