diff --git a/app/pdb/image-color-profile-cmds.c b/app/pdb/image-color-profile-cmds.c index fbfcea0c6d..806bbd2e95 100644 --- a/app/pdb/image-color-profile-cmds.c +++ b/app/pdb/image-color-profile-cmds.c @@ -470,26 +470,31 @@ image_convert_color_profile_invoker (GimpProcedure *procedure, if (success) { - if (color_profile) - { - GimpColorProfile *profile; + GimpColorProfile *profile; + if (color_profile && g_bytes_get_size (color_profile) > 0) + { profile = gimp_color_profile_new_from_icc_profile (g_bytes_get_data (color_profile, NULL), g_bytes_get_size (color_profile), error); - - if (profile) - { - success = gimp_image_convert_color_profile (image, profile, - intent, bpc, - progress, error); - g_object_unref (profile); - } - else - success = FALSE; } else - success = FALSE; + { + profile = gimp_image_get_builtin_color_profile (image); + g_object_ref (profile); + } + + if (profile) + { + success = gimp_image_convert_color_profile (image, profile, + intent, bpc, + progress, error); + g_object_unref (profile); + } + else + { + success = FALSE; + } } return gimp_procedure_get_return_values (procedure, success, @@ -875,7 +880,7 @@ register_image_color_profile_procs (GimpPDB *pdb) "gimp-image-convert-color-profile"); gimp_procedure_set_static_help (procedure, "Convert the image's layers to a color profile", - "This procedure converts from the image's color profile (or the default RGB or grayscale profile if none is set) to the given color profile. Only RGB and grayscale color profiles are accepted, according to the image's type.", + "This procedure converts from the image's color profile (or the built-in RGB or grayscale profile if none is set) to the given color profile. Only RGB and grayscale color profiles are accepted, according to the image's type.", NULL); gimp_procedure_set_static_attribution (procedure, "Michael Natterer ", diff --git a/libgimp/gimpimagecolorprofile.c b/libgimp/gimpimagecolorprofile.c index 1d380dcb52..71c99b56f0 100644 --- a/libgimp/gimpimagecolorprofile.c +++ b/libgimp/gimpimagecolorprofile.c @@ -212,14 +212,14 @@ gimp_image_get_effective_color_profile (GimpImage *image) /** * gimp_image_convert_color_profile: * @image: The image. - * @profile: The color profile to convert to. + * @profile: (nullable): The color profile to convert to. * @intent: Rendering intent. * @bpc: Black point compensation. * - * Convert the image's layers to a color profile + * Convert the image's layers to a color profile. * * This procedure converts from the image's color profile (or the - * default profile if none is set) to the given color profile. + * built-in profile if none is set) to the given color profile. * * Only RGB and grayscale color profiles are accepted, according to the * image's type. diff --git a/libgimp/gimpimagecolorprofile_pdb.c b/libgimp/gimpimagecolorprofile_pdb.c index e0cc650744..0ce5d6ee22 100644 --- a/libgimp/gimpimagecolorprofile_pdb.c +++ b/libgimp/gimpimagecolorprofile_pdb.c @@ -470,14 +470,14 @@ gimp_image_set_simulation_bpc (GimpImage *image, /** * _gimp_image_convert_color_profile: * @image: The image. - * @color_profile: The serialized color profile. + * @color_profile: (nullable): The serialized color profile. * @intent: Rendering intent. * @bpc: Black point compensation. * * Convert the image's layers to a color profile * * This procedure converts from the image's color profile (or the - * default RGB or grayscale profile if none is set) to the given color + * built-in RGB or grayscale profile if none is set) to the given color * profile. Only RGB and grayscale color profiles are accepted, * according to the image's type. * diff --git a/pdb/groups/image_color_profile.pdb b/pdb/groups/image_color_profile.pdb index 9db799a42b..8f2f81bae6 100644 --- a/pdb/groups/image_color_profile.pdb +++ b/pdb/groups/image_color_profile.pdb @@ -453,7 +453,7 @@ sub image_convert_color_profile { $blurb = "Convert the image's layers to a color profile"; $help = <<'HELP'; -This procedure converts from the image's color profile (or the default +This procedure converts from the image's color profile (or the built-in RGB or grayscale profile if none is set) to the given color profile. Only RGB and grayscale color profiles are accepted, according to the image's type. @@ -466,7 +466,7 @@ HELP @inargs = ( { name => 'image', type => 'image', desc => 'The image' }, - { name => 'color_profile', type => 'bytes', + { name => 'color_profile', type => 'bytes', none_ok => 1, desc => 'The serialized color profile' }, { name => 'intent', type => 'enum GimpColorRenderingIntent', desc => 'Rendering intent' }, @@ -477,26 +477,31 @@ HELP %invoke = ( code => <<'CODE' { - if (color_profile) - { - GimpColorProfile *profile; + GimpColorProfile *profile; + if (color_profile && g_bytes_get_size (color_profile) > 0) + { profile = gimp_color_profile_new_from_icc_profile (g_bytes_get_data (color_profile, NULL), g_bytes_get_size (color_profile), error); - - if (profile) - { - success = gimp_image_convert_color_profile (image, profile, - intent, bpc, - progress, error); - g_object_unref (profile); - } - else - success = FALSE; } else - success = FALSE; + { + profile = gimp_image_get_builtin_color_profile (image); + g_object_ref (profile); + } + + if (profile) + { + success = gimp_image_convert_color_profile (image, profile, + intent, bpc, + progress, error); + g_object_unref (profile); + } + else + { + success = FALSE; + } } CODE );