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.
This commit is contained in:
Michael Natterer 2015-08-30 01:29:46 +02:00
parent 4c7050b2d7
commit 802a53fa54
1 changed files with 16 additions and 3 deletions

View File

@ -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);
}